summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-16 11:43:32 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-16 11:43:32 -0400
commitc08f48e254be65b9899f4597cd88f479c6442646 (patch)
treeb113e43c6da1f80ca92f6a1fb4ede73278cf716a
parent3beaa30ca6a873021241b88b7350fb3574b82e75 (diff)
downloadcmd2-git-c08f48e254be65b9899f4597cd88f479c6442646.tar.gz
Fixed a bunch of examples which were broken due to moving DEFAULT_SHORTCUTS from cmd2.py to constants.py
-rwxr-xr-xREADME.md2
-rw-r--r--cmd2/__init__.py1
-rw-r--r--docs/settingchanges.rst2
-rwxr-xr-xexamples/arg_print.py2
-rwxr-xr-xexamples/cmd_as_argument.py2
-rwxr-xr-xexamples/colors.py2
-rwxr-xr-xexamples/decorator_example.py2
-rwxr-xr-xexamples/example.py2
-rwxr-xr-xexamples/pirate.py2
-rwxr-xr-xexamples/plumbum_colors.py2
10 files changed, 10 insertions, 9 deletions
diff --git a/README.md b/README.md
index c0fd8b7e..139c911d 100755
--- a/README.md
+++ b/README.md
@@ -241,7 +241,7 @@ class CmdLineApp(cmd2.Cmd):
def __init__(self):
self.maxrepeats = 3
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'&': 'speak'})
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
diff --git a/cmd2/__init__.py b/cmd2/__init__.py
index 1072a3c7..e86fb9bb 100644
--- a/cmd2/__init__.py
+++ b/cmd2/__init__.py
@@ -12,4 +12,5 @@ except DistributionNotFound:
from .cmd2 import Cmd, Statement, EmptyStatement, categorize
from .cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args, with_category
+from .constants import DEFAULT_SHORTCUTS
from .pyscript_bridge import CommandResult
diff --git a/docs/settingchanges.rst b/docs/settingchanges.rst
index aa6d9084..0e4feac1 100644
--- a/docs/settingchanges.rst
+++ b/docs/settingchanges.rst
@@ -33,7 +33,7 @@ To define more shortcuts, update the dict ``App.shortcuts`` with the
class App(Cmd2):
def __init__(self):
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'*': 'sneeze', '~': 'squirm'})
cmd2.Cmd.__init__(self, shortcuts=shortcuts)
diff --git a/examples/arg_print.py b/examples/arg_print.py
index 48bcbd13..3f7f3815 100755
--- a/examples/arg_print.py
+++ b/examples/arg_print.py
@@ -19,7 +19,7 @@ class ArgumentAndOptionPrinter(cmd2.Cmd):
def __init__(self):
# Create command shortcuts which are typically 1 character abbreviations which can be used in place of a command
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'$': 'aprint', '%': 'oprint'})
super().__init__(shortcuts=shortcuts)
diff --git a/examples/cmd_as_argument.py b/examples/cmd_as_argument.py
index 1e7901b9..49a50670 100755
--- a/examples/cmd_as_argument.py
+++ b/examples/cmd_as_argument.py
@@ -28,7 +28,7 @@ class CmdLineApp(cmd2.Cmd):
MUMBLE_LAST = ['right?']
def __init__(self):
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'&': 'speak'})
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
super().__init__(allow_cli_args=False, use_ipython=True, multiline_commands=['orate'], shortcuts=shortcuts)
diff --git a/examples/colors.py b/examples/colors.py
index fdc0e0bd..f8a9dfdb 100755
--- a/examples/colors.py
+++ b/examples/colors.py
@@ -63,7 +63,7 @@ class CmdLineApp(cmd2.Cmd):
MUMBLE_LAST = ['right?']
def __init__(self):
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'&': 'speak'})
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
super().__init__(use_ipython=True, multiline_commands=['orate'], shortcuts=shortcuts)
diff --git a/examples/decorator_example.py b/examples/decorator_example.py
index bb0d58c0..4f68653e 100755
--- a/examples/decorator_example.py
+++ b/examples/decorator_example.py
@@ -19,7 +19,7 @@ import cmd2
class CmdLineApp(cmd2.Cmd):
""" Example cmd2 application. """
def __init__(self, ip_addr=None, port=None, transcript_files=None):
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'&': 'speak'})
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
super().__init__(use_ipython=False, transcript_files=transcript_files, multiline_commands=['orate'],
diff --git a/examples/example.py b/examples/example.py
index a1ec893c..24be5d5d 100755
--- a/examples/example.py
+++ b/examples/example.py
@@ -26,7 +26,7 @@ class CmdLineApp(cmd2.Cmd):
MUMBLE_LAST = ['right?']
def __init__(self):
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'&': 'speak'})
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
super().__init__(use_ipython=False, multiline_commands=['orate'], shortcuts=shortcuts)
diff --git a/examples/pirate.py b/examples/pirate.py
index 9abbe4e6..699ee80c 100755
--- a/examples/pirate.py
+++ b/examples/pirate.py
@@ -29,7 +29,7 @@ class Pirate(cmd2.Cmd):
"""A piratical example cmd2 application involving looting and drinking."""
def __init__(self):
"""Initialize the base class as well as this one"""
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'~': 'sing'})
super().__init__(multiline_commands=['sing'], terminators=[MULTILINE_TERMINATOR, '...'], shortcuts=shortcuts)
diff --git a/examples/plumbum_colors.py b/examples/plumbum_colors.py
index 774dc7e4..2c57c22b 100755
--- a/examples/plumbum_colors.py
+++ b/examples/plumbum_colors.py
@@ -66,7 +66,7 @@ class CmdLineApp(cmd2.Cmd):
MUMBLE_LAST = ['right?']
def __init__(self):
- shortcuts = dict(self.DEFAULT_SHORTCUTS)
+ shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
shortcuts.update({'&': 'speak'})
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
super().__init__(use_ipython=True, multiline_commands=['orate'], shortcuts=shortcuts)