diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-14 00:06:19 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-14 00:06:19 -0400 |
commit | d2ebee4a6e55798f9d5fa41f8e2a200005b87cde (patch) | |
tree | 49758371d81c2947a852aecbe6a5065d3c37013f /examples/arg_print.py | |
parent | 88b45e12b0c2c9e7f8e386504f2d6808f396560b (diff) | |
download | cmd2-git-d2ebee4a6e55798f9d5fa41f8e2a200005b87cde.tar.gz |
Fixed how shortcuts are set in examples
Diffstat (limited to 'examples/arg_print.py')
-rwxr-xr-x | examples/arg_print.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/examples/arg_print.py b/examples/arg_print.py index a7b938e3..edcc8444 100755 --- a/examples/arg_print.py +++ b/examples/arg_print.py @@ -19,12 +19,9 @@ class ArgumentAndOptionPrinter(cmd2.Cmd): def __init__(self): # Create command shortcuts which are typically 1 character abbreviations which can be used in place of a command - self.shortcuts.update({'$': 'aprint', '%': 'oprint'}) - - # Make sure to call this super class __init__ *after* setting and/or updating shortcuts - super().__init__() - # NOTE: It is critical that the super class __init__ method be called AFTER updating certain parameters which - # are not settable at runtime. This includes the shortcuts, etc. + shortcuts = dict(self.DEFAULT_SHORTCUTS) + shortcuts.update({'$': 'aprint', '%': 'oprint'}) + super().__init__(shortcuts=shortcuts) def do_aprint(self, statement): """Print the argument string this basic command is called with.""" |