summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-08-25 12:03:49 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2020-08-25 12:03:49 -0400
commit5942f2105eb83140a8ab37e655e2561c4d17d3a2 (patch)
tree09f6a2a6da8a0da4c8150b84988f41ad571312f6 /cmd2/cmd2.py
parenta394ed3b83be17986e168b8d0817892cbabd088f (diff)
parent97c348c599d8fa963553593e5c19fb100b85e313 (diff)
downloadcmd2-git-5942f2105eb83140a8ab37e655e2561c4d17d3a2.tar.gz
Merge branch 'master' into 2.0
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index db4ba86f..cc2ddcb4 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -664,7 +664,9 @@ class Cmd(cmd.Cmd):
raise CommandSetRegistrationError('Could not find argparser for command "{}" needed by subcommand: {}'
.format(command_name, str(method)))
- subcmd_parser.set_defaults(cmd2_handler=method)
+ # Set the subcommand handler function
+ defaults = {constants.NS_ATTR_SUBCMD_HANDLER: method}
+ subcmd_parser.set_defaults(**defaults)
def find_subcommand(action: argparse.ArgumentParser, subcmd_names: List[str]) -> argparse.ArgumentParser:
if not subcmd_names:
@@ -826,7 +828,7 @@ class Cmd(cmd.Cmd):
def poutput(self, msg: Any = '', *, end: str = '\n') -> None:
"""Print message to self.stdout and appends a newline by default
- Also handles BrokenPipeError exceptions for when a commands's output has
+ Also handles BrokenPipeError exceptions for when a command's output has
been piped to another process and that process terminates before the
cmd2 command is finished executing.