diff options
author | kotfu <jared@kotfu.net> | 2018-05-24 19:07:45 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-24 19:07:45 -0600 |
commit | cad21a60fa92ebe4a7c177142d273f9f7497967b (patch) | |
tree | 3cfa590653af8b7570bd4073384467d2ca736fa0 /examples/example.py | |
parent | 5d64ebee348aeffb02fc385f903c9af431e3721b (diff) | |
parent | 190fecb34ac91e25f64615f378d6d59ef6d77de8 (diff) | |
download | cmd2-git-cad21a60fa92ebe4a7c177142d273f9f7497967b.tar.gz |
Merge pull request #413 from python-cmd2/speedup_import
Defer certain imports
Diffstat (limited to 'examples/example.py')
-rwxr-xr-x | examples/example.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/example.py b/examples/example.py index f07b9c74..264abd84 100755 --- a/examples/example.py +++ b/examples/example.py @@ -14,10 +14,10 @@ the transcript. import random import argparse -from cmd2.cmd2 import Cmd, with_argparser +import cmd2 -class CmdLineApp(Cmd): +class CmdLineApp(cmd2.Cmd): """ Example cmd2 application. """ # Setting this true makes it run a shell command if a cmd2/cmd command doesn't exist @@ -43,7 +43,7 @@ class CmdLineApp(Cmd): speak_parser.add_argument('-r', '--repeat', type=int, help='output [n] times') speak_parser.add_argument('words', nargs='+', help='words to say') - @with_argparser(speak_parser) + @cmd2.with_argparser(speak_parser) def do_speak(self, args): """Repeats what you tell me to.""" words = [] @@ -65,7 +65,7 @@ class CmdLineApp(Cmd): mumble_parser.add_argument('-r', '--repeat', type=int, help='how many times to repeat') mumble_parser.add_argument('words', nargs='+', help='words to say') - @with_argparser(mumble_parser) + @cmd2.with_argparser(mumble_parser) def do_mumble(self, args): """Mumbles what you tell me to.""" repetitions = args.repeat or 1 |