summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-10-05 13:32:04 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-10-05 13:32:04 -0400
commit734796b895bb85d67c651d9e8e8bf71e7d60b7e3 (patch)
tree5879270409a4992622da2933275ccaae30525ee6 /cmd2/cmd2.py
parent49cbec9969b4b53248d6097d8f395d92c74f7228 (diff)
downloadcmd2-git-734796b895bb85d67c651d9e8e8bf71e7d60b7e3.tar.gz
Using sub-command instead of subcommand where possible to be consistent with argparse
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 7aaacdb1..c95fbd51 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2204,7 +2204,7 @@ class Cmd(cmd.Cmd):
return stop
- # ----- Alias subcommand functions -----
+ # ----- Alias sub-command functions -----
def alias_create(self, args: argparse.Namespace):
"""Create or overwrite an alias"""
@@ -2267,8 +2267,8 @@ class Cmd(cmd.Cmd):
" macro")
alias_parser = ACArgumentParser(description=alias_description, epilog=alias_epilog, prog='alias')
- # Add subcommands to alias
- alias_subparsers = alias_parser.add_subparsers(title='sub-commands')
+ # Add sub-commands to alias
+ alias_subparsers = alias_parser.add_subparsers()
# alias -> create
alias_create_help = "create or overwrite an alias"
@@ -2326,13 +2326,13 @@ class Cmd(cmd.Cmd):
"""Manage aliases"""
func = getattr(args, 'func', None)
if func is not None:
- # Call whatever subcommand function was selected
+ # Call whatever sub-command function was selected
func(self, args)
else:
- # No subcommand was provided, so call help
+ # No sub-command was provided, so call help
self.do_help('alias')
- # ----- Macro subcommand functions -----
+ # ----- Macro sub-command functions -----
def macro_create(self, args: argparse.Namespace):
"""Create or overwrite a macro"""
@@ -2445,8 +2445,8 @@ class Cmd(cmd.Cmd):
" alias")
macro_parser = ACArgumentParser(description=macro_description, epilog=macro_epilog, prog='macro')
- # Add subcommands to macro
- macro_subparsers = macro_parser.add_subparsers(title='sub-commands')
+ # Add sub-commands to macro
+ macro_subparsers = macro_parser.add_subparsers()
# macro -> create
macro_create_help = "create or overwrite a macro"
@@ -2527,10 +2527,10 @@ class Cmd(cmd.Cmd):
"""Manage macros"""
func = getattr(args, 'func', None)
if func is not None:
- # Call whatever subcommand function was selected
+ # Call whatever sub-command function was selected
func(self, args)
else:
- # No subcommand was provided, so call help
+ # No sub-command was provided, so call help
self.do_help('macro')
def complete_help_command(self, text: str, line: str, begidx: int, endidx: int) -> List[str]:
@@ -2551,7 +2551,7 @@ class Cmd(cmd.Cmd):
if not tokens:
return []
- # Must have at least 3 args for 'help command subcommand'
+ # Must have at least 3 args for 'help command sub-command'
if len(tokens) < 3:
return []
@@ -2580,7 +2580,7 @@ class Cmd(cmd.Cmd):
setattr(help_parser.add_argument('command', help="command to retrieve help for", nargs="?"),
ACTION_ARG_CHOICES, ('complete_help_command',))
- setattr(help_parser.add_argument('subcommand', help="subcommand to retrieve help for",
+ setattr(help_parser.add_argument('subcommand', help="sub-command to retrieve help for",
nargs=argparse.REMAINDER),
ACTION_ARG_CHOICES, ('complete_help_subcommand',))
help_parser.add_argument('-v', '--verbose', action='store_true',