diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-12 20:13:55 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-12 20:13:55 -0400 |
commit | f594dc2d5be261eccaa277ee8279ac83f63b7a5b (patch) | |
tree | 9e15280c3fed9325a1e420298052dc5486f3e356 /examples/case_sensitive.py | |
parent | f517ff8e21b7ea861d8907e5302be49829de8b9c (diff) | |
download | cmd2-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 'examples/case_sensitive.py')
-rwxr-xr-x | examples/case_sensitive.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/case_sensitive.py b/examples/case_sensitive.py new file mode 100755 index 00000000..828ebc06 --- /dev/null +++ b/examples/case_sensitive.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# coding=utf-8 +"""A sample application demonstrating when commands are set to be case sensitive. + +By default cmd2 parses commands in a case-insensitive manner. But this behavior can be changed. +""" + +import cmd2 + + +class CaseSensitiveApp(cmd2.Cmd): + """ Example cmd2 application where commands are case-sensitive.""" + + def __init__(self): + # Set this before calling the super class __init__() + self.case_insensitive = False + + cmd2.Cmd.__init__(self) + + self.debug = True + + +if __name__ == '__main__': + app = CaseSensitiveApp() + app.cmdloop() |