summaryrefslogtreecommitdiff
path: root/examples/hooks.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-23 21:11:01 -0400
committerGitHub <noreply@github.com>2019-06-23 21:11:01 -0400
commitbef07746e33da9def33d814913891384a545a95c (patch)
tree86b162f79663f70cbe88e64deb4cecb93106ba68 /examples/hooks.py
parentc12ba0ff11b3a8fd083c641cb9149aff6494bbf9 (diff)
parenteb1936e568a2ca4817ab0cd640220a5bc355e226 (diff)
downloadcmd2-git-bef07746e33da9def33d814913891384a545a95c.tar.gz
Merge pull request #703 from python-cmd2/public_api
Minimize public API of cmd2.Cmd class
Diffstat (limited to 'examples/hooks.py')
-rwxr-xr-xexamples/hooks.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/hooks.py b/examples/hooks.py
index 42224403..39a7a0d5 100755
--- a/examples/hooks.py
+++ b/examples/hooks.py
@@ -66,7 +66,7 @@ class CmdLineApp(cmd2.Cmd):
command_pattern = re.compile(r'^([^\s\d]+)(\d+)')
match = command_pattern.search(command)
if match:
- data.statement = self.statement_parser.parse("{} {} {}".format(
+ data.statement = self._statement_parser.parse("{} {} {}".format(
match.group(1),
match.group(2),
'' if data.statement.args is None else data.statement.args
@@ -76,7 +76,7 @@ class CmdLineApp(cmd2.Cmd):
def downcase_hook(self, data: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
"""A hook to make uppercase commands lowercase."""
command = data.statement.command.lower()
- data.statement = self.statement_parser.parse("{} {}".format(
+ data.statement = self._statement_parser.parse("{} {}".format(
command,
'' if data.statement.args is None else data.statement.args
))
@@ -90,7 +90,7 @@ class CmdLineApp(cmd2.Cmd):
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)
+ data.statement = self._statement_parser.parse(raw)
return data
@cmd2.with_argument_list