summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-19 10:06:19 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-19 10:06:19 -0400
commit920a9faa050441fbe064eed200f74dbdc0ba9663 (patch)
tree8c9007dd44d5d3e1ef5a5171783acbc606f2ca29 /cmd2
parent128d94accb0a6a8ab7197d26dab2cdafd83a1922 (diff)
downloadcmd2-git-920a9faa050441fbe064eed200f74dbdc0ba9663.tar.gz
Changed all uses of sub-command to subcommand
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/argparse_completer.py10
-rw-r--r--cmd2/argparse_custom.py4
-rw-r--r--cmd2/cmd2.py20
3 files changed, 17 insertions, 17 deletions
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py
index a741882c..e7f3a0e2 100644
--- a/cmd2/argparse_completer.py
+++ b/cmd2/argparse_completer.py
@@ -108,7 +108,7 @@ class AutoCompleter(object):
self._flag_to_action = {} # maps flags to the argparse action object
self._positional_actions = [] # actions for positional arguments (by position index)
- # maps action to sub-command autocompleter:
+ # maps action to subcommand autocompleter:
# action -> dict(sub_command -> completer)
self._positional_completers = {}
@@ -264,7 +264,7 @@ class AutoCompleter(object):
if pos_index < len(self._positional_actions):
action = self._positional_actions[pos_index]
- # Are we at a sub-command? If so, forward to the matching completer
+ # Are we at a subcommand? If so, forward to the matching completer
if isinstance(action, argparse._SubParsersAction):
sub_completers = self._positional_completers[action]
if token in sub_completers:
@@ -412,7 +412,7 @@ class AutoCompleter(object):
def complete_command_help(self, tokens: List[str], text: str, line: str, begidx: int, endidx: int) -> List[str]:
"""
- Supports cmd2's help command in the completion of sub-command names
+ Supports cmd2's help command in the completion of subcommand names
:param tokens: command line tokens
:param text: the string prefix we are attempting to match (all matches must begin with it)
:param line: the current input line with leading whitespace removed
@@ -422,7 +422,7 @@ class AutoCompleter(object):
"""
for token in tokens[self._token_start_index:]:
if self._positional_completers:
- # For now argparse only allows 1 sub-command group per level
+ # For now argparse only allows 1 subcommand group per level
# so this will only loop once.
for completers in self._positional_completers.values():
if token in completers:
@@ -439,7 +439,7 @@ class AutoCompleter(object):
"""
for token in tokens[self._token_start_index:]:
if self._positional_completers:
- # For now argparse only allows 1 sub-command group per level
+ # For now argparse only allows 1 subcommand group per level
# so this will only loop once.
for completers in self._positional_completers.values():
if token in completers:
diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py
index 8da47461..090abde1 100644
--- a/cmd2/argparse_custom.py
+++ b/cmd2/argparse_custom.py
@@ -26,7 +26,7 @@ value with no upper bound, use a 1-item tuple (min,)
Tab Completion:
cmd2 uses its AutoCompleter class to enable argparse-based tab completion on all commands that use the
- @with_argparse wrappers. Out of the box you get tab completion of commands, sub-commands, and flag names,
+ @with_argparse wrappers. Out of the box you get tab completion of commands, subcommands, and flag names,
as well as instructive hints about the current argument that print when tab is pressed. In addition,
you can add tab completion for each argument's values using parameters passed to add_argument().
@@ -646,7 +646,7 @@ class Cmd2ArgumentParser(argparse.ArgumentParser):
def add_subparsers(self, **kwargs):
"""Custom override. Sets a default title if one was not given."""
if 'title' not in kwargs:
- kwargs['title'] = 'sub-commands'
+ kwargs['title'] = 'subcommands'
return super().add_subparsers(**kwargs)
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index d8bb3b1b..6ab35790 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2327,7 +2327,7 @@ class Cmd(cmd.Cmd):
if saved_readline_settings is not None:
self._restore_readline(saved_readline_settings)
- # ----- Alias sub-command functions -----
+ # ----- Alias subcommand functions -----
def _alias_create(self, args: argparse.Namespace) -> None:
"""Create or overwrite an alias"""
@@ -2392,7 +2392,7 @@ class Cmd(cmd.Cmd):
" macro")
alias_parser = Cmd2ArgumentParser(description=alias_description, epilog=alias_epilog, prog='alias')
- # Add sub-commands to alias
+ # Add subcommands to alias
alias_subparsers = alias_parser.add_subparsers()
# alias -> create
@@ -2450,13 +2450,13 @@ class Cmd(cmd.Cmd):
"""Manage aliases"""
func = getattr(args, 'func', None)
if func is not None:
- # Call whatever sub-command function was selected
+ # Call whatever subcommand function was selected
func(self, args)
else:
- # No sub-command was provided, so call help
+ # No subcommand was provided, so call help
self.do_help('alias')
- # ----- Macro sub-command functions -----
+ # ----- Macro subcommand functions -----
def _macro_create(self, args: argparse.Namespace) -> None:
"""Create or overwrite a macro"""
@@ -2572,7 +2572,7 @@ class Cmd(cmd.Cmd):
" alias")
macro_parser = Cmd2ArgumentParser(description=macro_description, epilog=macro_epilog, prog='macro')
- # Add sub-commands to macro
+ # Add subcommands to macro
macro_subparsers = macro_parser.add_subparsers()
# macro -> create
@@ -2652,10 +2652,10 @@ class Cmd(cmd.Cmd):
"""Manage macros"""
func = getattr(args, 'func', None)
if func is not None:
- # Call whatever sub-command function was selected
+ # Call whatever subcommand function was selected
func(self, args)
else:
- # No sub-command was provided, so call help
+ # No subcommand was provided, so call help
self.do_help('macro')
def complete_help_command(self, text: str, line: str, begidx: int, endidx: int) -> List[str]:
@@ -2676,7 +2676,7 @@ class Cmd(cmd.Cmd):
if not tokens:
return []
- # Must have at least 3 args for 'help command sub-command'
+ # Must have at least 3 args for 'help command subcommand'
if len(tokens) < 3:
return []
@@ -2705,7 +2705,7 @@ class Cmd(cmd.Cmd):
help_parser = Cmd2ArgumentParser()
help_parser.add_argument('command', nargs=argparse.OPTIONAL, help="command to retrieve help for",
completer_method=complete_help_command)
- help_parser.add_argument('subcommand', nargs=argparse.REMAINDER, help="sub-command to retrieve help for",
+ help_parser.add_argument('subcommand', nargs=argparse.REMAINDER, help="subcommand to retrieve help for",
completer_method=complete_help_subcommand)
help_parser.add_argument('-v', '--verbose', action='store_true',
help="print a list of all commands with descriptions of each")