diff options
| author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-16 22:17:52 -0400 |
|---|---|---|
| committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-16 22:17:52 -0400 |
| commit | 24fdbbce8a7bb0df3b12fc91cb53a591777f9fb0 (patch) | |
| tree | b516a76aa6f89c3d93a83999c6952bee2cf89486 /cmd2.py | |
| parent | f68023a219e4e5b0997e28d7cc4f46eb05011665 (diff) | |
| download | cmd2-git-24fdbbce8a7bb0df3b12fc91cb53a591777f9fb0.tar.gz | |
Changing how commands are parsed if default_to_shell is True
Diffstat (limited to 'cmd2.py')
| -rwxr-xr-x | cmd2.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1578,8 +1578,17 @@ class Cmd(cmd.Cmd): break i, n = 0, len(line) - while i < n and line[i] in self.identchars: - i += 1 + + # If we are allowing shell commands, then allow any character in the command + if self.default_to_shell: + while i < n and line[i] != ' ': + i += 1 + + # Otherwise only allow those in identchars + else: + while i < n and line[i] in self.identchars: + i += 1 + command, arg = line[:i], line[i:].strip() return command, arg, line |
