summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-19 12:23:11 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-19 12:23:11 -0400
commit2244dea8f42714bdc5944f4a23f77e6c9ec21bf5 (patch)
tree3589dae1a0ba84f926a66f905a9d44ab82d2edb4 /cmd2/cmd2.py
parent88c492c9c5b9038dcc6acb85edf7857f632c0fb5 (diff)
downloadcmd2-git-2244dea8f42714bdc5944f4a23f77e6c9ec21bf5.tar.gz
Small refactor
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 130eb176..788e0294 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2182,8 +2182,10 @@ class Cmd(cmd.Cmd):
return self.do_shell(statement.command_and_args)
else:
+ err_msg = self.default_error.format(statement.command)
+
# Set apply_style to False so default_error's style is not overridden
- self.perror(self.default_error.format(statement.command), apply_style=False)
+ self.perror(err_msg, apply_style=False)
def _pseudo_raw_input(self, prompt: str) -> str:
"""Began life as a copy of cmd's cmdloop; like raw_input but
@@ -2736,8 +2738,10 @@ class Cmd(cmd.Cmd):
# If there is no help information then print an error
elif help_func is None and (func is None or not func.__doc__):
+ err_msg = self.help_error.format(args.command)
+
# Set apply_style to False so help_error's style is not overridden
- self.perror(self.help_error.format(args.command), apply_style=False)
+ self.perror(err_msg, apply_style=False)
# Otherwise delegate to cmd base class do_help()
else: