summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-12 20:13:55 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-12 20:13:55 -0400
commitf594dc2d5be261eccaa277ee8279ac83f63b7a5b (patch)
tree9e15280c3fed9325a1e420298052dc5486f3e356 /cmd2.py
parentf517ff8e21b7ea861d8907e5302be49829de8b9c (diff)
downloadcmd2-git-f594dc2d5be261eccaa277ee8279ac83f63b7a5b.tar.gz
Fixed a couple case sensitivity bugs and added an example
Bugs fixed: - Case-sensitive parsing was completely broken, this has been fixed - <Ctrl>+D to quit wasn't working when case-sensitive parsing was enabled, this is fixed Added a "case_sensitive.py" example in the examples directory for quickly testing case-sensitive command parsing behavior.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd2.py b/cmd2.py
index 4810dc26..f76072fe 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -891,13 +891,13 @@ class Cmd(cmd.Cmd):
try:
line = sm.input(safe_prompt)
except EOFError:
- line = 'EOF'
+ line = 'eof'
else:
self.stdout.write(safe_prompt)
self.stdout.flush()
line = self.stdin.readline()
if not len(line):
- line = 'EOF'
+ line = 'eof'
else:
line = line.rstrip('\r\n')
@@ -1846,6 +1846,10 @@ class ParserManager:
if case_insensitive:
multilineCommand.setParseAction(lambda x: x[0].lower())
oneline_command.setParseAction(lambda x: x[0].lower())
+ else:
+ multilineCommand.setParseAction(lambda x: x[0])
+ oneline_command.setParseAction(lambda x: x[0])
+
if blankLinesAllowed:
blankLineTerminationParser = pyparsing.NoMatch
else: