summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd2.py b/cmd2.py
index 28e22c45..d2f26166 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -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