diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-10 11:51:06 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-10 11:51:06 -0400 |
commit | 1c2dc43a982eada206975f97e8e49c5ea95d9dd5 (patch) | |
tree | abc1772a5a7fab8fa7f4e996a82f654d61517581 /cmd2/cmd2.py | |
parent | b188531a0c7277b7e3d70d6c096e00f5653415c3 (diff) | |
download | cmd2-git-1c2dc43a982eada206975f97e8e49c5ea95d9dd5.tar.gz |
Small refactoring to simplify code
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 0d14d5ad..4ac63a07 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1926,8 +1926,6 @@ class Cmd(cmd.Cmd): :param statement: the parsed statement from the command line :return: the resolved macro or None on error """ - from itertools import islice - if statement.command not in self.macros.keys(): raise KeyError('{} is not a macro'.format(statement.command)) @@ -1960,7 +1958,7 @@ class Cmd(cmd.Cmd): resolved = parts[0] + replacement + parts[1] # Append extra arguments and use statement.arg_list since these arguments need their quotes preserved - for arg in islice(statement.arg_list, macro.minimum_arg_count, None): + for arg in statement.arg_list[macro.minimum_arg_count:]: resolved += ' ' + arg # Restore any terminator, suffix, redirection, etc. |