summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-09-01 20:20:34 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2020-09-01 20:20:34 -0400
commit72fc6bf105f4b712d5a6f991746fd2f9084893fc (patch)
treeed1db5dc62c036a9cb86d4d3c8287c73e10d08d4
parenta33da043985257e1ed0ac7b3524e27d62611b1ac (diff)
downloadcmd2-git-72fc6bf105f4b712d5a6f991746fd2f9084893fc.tar.gz
Updated docs
-rw-r--r--docs/features/modular_commands.rst8
-rw-r--r--examples/modular_commands/commandset_complex.py4
-rw-r--r--examples/modular_commands_dynamic.py2
-rw-r--r--examples/modular_subcommands.py4
-rw-r--r--tests_isolated/test_commandset/test_commandset.py13
5 files changed, 15 insertions, 16 deletions
diff --git a/docs/features/modular_commands.rst b/docs/features/modular_commands.rst
index 43779872..05e21f84 100644
--- a/docs/features/modular_commands.rst
+++ b/docs/features/modular_commands.rst
@@ -171,7 +171,7 @@ You may need to disable command auto-loading if you need dynamically load comman
self._fruits = LoadableFruits()
self._vegetables = LoadableVegetables()
- load_parser = cmd2.Cmd2ArgumentParser('load')
+ load_parser = cmd2.Cmd2ArgumentParser()
load_parser.add_argument('cmds', choices=['fruits', 'vegetables'])
@with_argparser(load_parser)
@@ -281,7 +281,7 @@ command and each CommandSet
self._fruits = LoadableFruits()
self._vegetables = LoadableVegetables()
- load_parser = cmd2.Cmd2ArgumentParser('load')
+ load_parser = cmd2.Cmd2ArgumentParser()
load_parser.add_argument('cmds', choices=['fruits', 'vegetables'])
@with_argparser(load_parser)
@@ -311,8 +311,8 @@ command and each CommandSet
self.unregister_command_set(self._vegetables)
self.poutput('Vegetables unloaded')
- cut_parser = cmd2.Cmd2ArgumentParser('cut')
- cut_subparsers = cut_parser.add_subparsers(title='item', help='item to cut', unloadable=True)
+ cut_parser = cmd2.Cmd2ArgumentParser()
+ cut_subparsers = cut_parser.add_subparsers(title='item', help='item to cut')
@with_argparser(cut_parser)
def do_cut(self, ns: argparse.Namespace):
diff --git a/examples/modular_commands/commandset_complex.py b/examples/modular_commands/commandset_complex.py
index 7c6b1300..579c0677 100644
--- a/examples/modular_commands/commandset_complex.py
+++ b/examples/modular_commands/commandset_complex.py
@@ -20,7 +20,7 @@ class CommandSetA(cmd2.CommandSet):
"""Banana Command"""
self._cmd.poutput('Banana!!')
- cranberry_parser = cmd2.Cmd2ArgumentParser('cranberry')
+ cranberry_parser = cmd2.Cmd2ArgumentParser()
cranberry_parser.add_argument('arg1', choices=['lemonade', 'juice', 'sauce'])
@cmd2.with_argparser(cranberry_parser, with_unknown_args=True)
@@ -44,7 +44,7 @@ class CommandSetA(cmd2.CommandSet):
def complete_durian(self, text: str, line: str, begidx: int, endidx: int) -> List[str]:
return utils.basic_complete(text, line, begidx, endidx, ['stinks', 'smells', 'disgusting'])
- elderberry_parser = cmd2.Cmd2ArgumentParser('elderberry')
+ elderberry_parser = cmd2.Cmd2ArgumentParser()
elderberry_parser.add_argument('arg1')
@cmd2.with_category('Alone')
diff --git a/examples/modular_commands_dynamic.py b/examples/modular_commands_dynamic.py
index eb6283a7..b2be5dd1 100644
--- a/examples/modular_commands_dynamic.py
+++ b/examples/modular_commands_dynamic.py
@@ -50,7 +50,7 @@ class ExampleApp(cmd2.Cmd):
self._fruits = LoadableFruits()
self._vegetables = LoadableVegetables()
- load_parser = cmd2.Cmd2ArgumentParser('load')
+ load_parser = cmd2.Cmd2ArgumentParser()
load_parser.add_argument('cmds', choices=['fruits', 'vegetables'])
@with_argparser(load_parser)
diff --git a/examples/modular_subcommands.py b/examples/modular_subcommands.py
index 94959349..4445fde2 100644
--- a/examples/modular_subcommands.py
+++ b/examples/modular_subcommands.py
@@ -62,7 +62,7 @@ class ExampleApp(cmd2.Cmd):
self._fruits = LoadableFruits()
self._vegetables = LoadableVegetables()
- load_parser = cmd2.Cmd2ArgumentParser('load')
+ load_parser = cmd2.Cmd2ArgumentParser()
load_parser.add_argument('cmds', choices=['fruits', 'vegetables'])
@with_argparser(load_parser)
@@ -92,7 +92,7 @@ class ExampleApp(cmd2.Cmd):
self.unregister_command_set(self._vegetables)
self.poutput('Vegetables unloaded')
- cut_parser = cmd2.Cmd2ArgumentParser('cut')
+ cut_parser = cmd2.Cmd2ArgumentParser()
cut_subparsers = cut_parser.add_subparsers(title='item', help='item to cut')
@with_argparser(cut_parser)
diff --git a/tests_isolated/test_commandset/test_commandset.py b/tests_isolated/test_commandset/test_commandset.py
index 407c386f..cbac7654 100644
--- a/tests_isolated/test_commandset/test_commandset.py
+++ b/tests_isolated/test_commandset/test_commandset.py
@@ -40,7 +40,7 @@ class CommandSetA(CommandSetBase):
"""Banana Command"""
self._cmd.poutput('Banana!!')
- cranberry_parser = cmd2.Cmd2ArgumentParser('cranberry')
+ cranberry_parser = cmd2.Cmd2ArgumentParser()
cranberry_parser.add_argument('arg1', choices=['lemonade', 'juice', 'sauce'])
@cmd2.with_argparser(cranberry_parser, with_unknown_args=True)
@@ -65,7 +65,7 @@ class CommandSetA(CommandSetBase):
def complete_durian(self, text: str, line: str, begidx: int, endidx: int) -> List[str]:
return utils.basic_complete(text, line, begidx, endidx, ['stinks', 'smells', 'disgusting'])
- elderberry_parser = cmd2.Cmd2ArgumentParser('elderberry')
+ elderberry_parser = cmd2.Cmd2ArgumentParser()
elderberry_parser.add_argument('arg1')
@cmd2.with_category('Alone')
@@ -319,7 +319,7 @@ class LoadableBase(cmd2.CommandSet):
self._dummy = dummy # prevents autoload
self._cut_called = False
- cut_parser = cmd2.Cmd2ArgumentParser('cut')
+ cut_parser = cmd2.Cmd2ArgumentParser()
cut_subparsers = cut_parser.add_subparsers(title='item', help='item to cut')
def namespace_provider(self) -> argparse.Namespace:
@@ -340,8 +340,7 @@ class LoadableBase(cmd2.CommandSet):
self._cmd.pwarning('This command does nothing without sub-parsers registered')
self._cmd.do_help('cut')
-
- stir_parser = cmd2.Cmd2ArgumentParser('stir')
+ stir_parser = cmd2.Cmd2ArgumentParser()
stir_subparsers = stir_parser.add_subparsers(title='item', help='what to stir')
@cmd2.with_argparser(stir_parser, ns_provider=namespace_provider)
@@ -613,7 +612,7 @@ class AppWithSubCommands(cmd2.Cmd):
def __init__(self, *args, **kwargs):
super(AppWithSubCommands, self).__init__(*args, **kwargs)
- cut_parser = cmd2.Cmd2ArgumentParser('cut')
+ cut_parser = cmd2.Cmd2ArgumentParser()
cut_subparsers = cut_parser.add_subparsers(title='item', help='item to cut')
@cmd2.with_argparser(cut_parser)
@@ -874,7 +873,7 @@ def test_bad_subcommand():
def __init__(self, *args, **kwargs):
super(BadSubcommandApp, self).__init__(*args, **kwargs)
- cut_parser = cmd2.Cmd2ArgumentParser('cut')
+ cut_parser = cmd2.Cmd2ArgumentParser()
cut_subparsers = cut_parser.add_subparsers(title='item', help='item to cut')
@cmd2.with_argparser(cut_parser)