summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd2/cmd2.py12
-rwxr-xr-xexamples/hooks.py2
2 files changed, 6 insertions, 8 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 5e0c1c07..8f5dfef3 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -298,12 +298,6 @@ class Cmd(cmd.Cmd):
"""
DEFAULT_SHORTCUTS = {'?': 'help', '!': 'shell', '@': 'load', '@@': '_relative_load'}
- # Attributes which are NOT dynamically settable at runtime
- allow_cli_args = True # Should arguments passed on the command-line be processed as commands?
- default_to_shell = False # Attempt to run unrecognized commands as shell commands
- quit_on_sigint = False # Quit the loop on interrupt instead of just resetting prompt
- reserved_words = []
-
# Attributes which ARE dynamically settable at runtime
colors = constants.COLORS_TERMINAL
continuation_prompt = '> '
@@ -371,6 +365,11 @@ class Cmd(cmd.Cmd):
# Call super class constructor
super().__init__(completekey=completekey, stdin=stdin, stdout=stdout)
+ # Attributes which should NOT be dynamically settable at runtime
+ self.allow_cli_args = True # Should arguments passed on the command-line be processed as commands?
+ self.default_to_shell = False # Attempt to run unrecognized commands as shell commands
+ self.quit_on_sigint = False # Quit the loop on interrupt instead of just resetting prompt
+
# Commands to exclude from the help menu and tab completion
self.hidden_commands = ['eof', 'eos', '_relative_load']
@@ -386,7 +385,6 @@ class Cmd(cmd.Cmd):
self.pystate = {}
self.py_history = []
self.pyscript_name = 'app'
- self.keywords = self.reserved_words + self.get_all_commands()
if shortcuts is None:
shortcuts = self.DEFAULT_SHORTCUTS
diff --git a/examples/hooks.py b/examples/hooks.py
index b6f6263e..dd21e58a 100755
--- a/examples/hooks.py
+++ b/examples/hooks.py
@@ -87,7 +87,7 @@ class CmdLineApp(cmd2.Cmd):
func = self.cmd_func(data.statement.command)
if func is None:
# check if the entered command might be an abbreviation
- possible_cmds = [cmd for cmd in self.keywords if cmd.startswith(data.statement.command)]
+ possible_cmds = [cmd for cmd in self.get_all_commands() if cmd.startswith(data.statement.command)]
if len(possible_cmds) == 1:
raw = data.statement.raw.replace(data.statement.command, possible_cmds[0], 1)
data.statement = self.statement_parser.parse(raw)