Skip to content

Commit c08f48e

Browse files
committed
Fixed a bunch of examples which were broken due to moving DEFAULT_SHORTCUTS from cmd2.py to constants.py
1 parent 3beaa30 commit c08f48e

File tree

10 files changed

+10
-9
lines changed

10 files changed

+10
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class CmdLineApp(cmd2.Cmd):
241241

242242
def __init__(self):
243243
self.maxrepeats = 3
244-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
244+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
245245
shortcuts.update({'&': 'speak'})
246246

247247
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell

cmd2/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212

1313
from .cmd2 import Cmd, Statement, EmptyStatement, categorize
1414
from .cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args, with_category
15+
from .constants import DEFAULT_SHORTCUTS
1516
from .pyscript_bridge import CommandResult

docs/settingchanges.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To define more shortcuts, update the dict ``App.shortcuts`` with the
3333

3434
class App(Cmd2):
3535
def __init__(self):
36-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
36+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
3737
shortcuts.update({'*': 'sneeze', '~': 'squirm'})
3838
cmd2.Cmd.__init__(self, shortcuts=shortcuts)
3939

examples/arg_print.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ArgumentAndOptionPrinter(cmd2.Cmd):
1919

2020
def __init__(self):
2121
# Create command shortcuts which are typically 1 character abbreviations which can be used in place of a command
22-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
22+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
2323
shortcuts.update({'$': 'aprint', '%': 'oprint'})
2424
super().__init__(shortcuts=shortcuts)
2525

examples/cmd_as_argument.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CmdLineApp(cmd2.Cmd):
2828
MUMBLE_LAST = ['right?']
2929

3030
def __init__(self):
31-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
31+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
3232
shortcuts.update({'&': 'speak'})
3333
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
3434
super().__init__(allow_cli_args=False, use_ipython=True, multiline_commands=['orate'], shortcuts=shortcuts)

examples/colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class CmdLineApp(cmd2.Cmd):
6363
MUMBLE_LAST = ['right?']
6464

6565
def __init__(self):
66-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
66+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
6767
shortcuts.update({'&': 'speak'})
6868
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
6969
super().__init__(use_ipython=True, multiline_commands=['orate'], shortcuts=shortcuts)

examples/decorator_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class CmdLineApp(cmd2.Cmd):
2020
""" Example cmd2 application. """
2121
def __init__(self, ip_addr=None, port=None, transcript_files=None):
22-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
22+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
2323
shortcuts.update({'&': 'speak'})
2424
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
2525
super().__init__(use_ipython=False, transcript_files=transcript_files, multiline_commands=['orate'],

examples/example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CmdLineApp(cmd2.Cmd):
2626
MUMBLE_LAST = ['right?']
2727

2828
def __init__(self):
29-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
29+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
3030
shortcuts.update({'&': 'speak'})
3131
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
3232
super().__init__(use_ipython=False, multiline_commands=['orate'], shortcuts=shortcuts)

examples/pirate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Pirate(cmd2.Cmd):
2929
"""A piratical example cmd2 application involving looting and drinking."""
3030
def __init__(self):
3131
"""Initialize the base class as well as this one"""
32-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
32+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
3333
shortcuts.update({'~': 'sing'})
3434
super().__init__(multiline_commands=['sing'], terminators=[MULTILINE_TERMINATOR, '...'], shortcuts=shortcuts)
3535

examples/plumbum_colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CmdLineApp(cmd2.Cmd):
6666
MUMBLE_LAST = ['right?']
6767

6868
def __init__(self):
69-
shortcuts = dict(self.DEFAULT_SHORTCUTS)
69+
shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
7070
shortcuts.update({'&': 'speak'})
7171
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
7272
super().__init__(use_ipython=True, multiline_commands=['orate'], shortcuts=shortcuts)

0 commit comments

Comments
 (0)