summaryrefslogtreecommitdiff
path: root/examples/case_sensitive.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/case_sensitive.py')
-rwxr-xr-xexamples/case_sensitive.py25
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()