summaryrefslogtreecommitdiff
path: root/examples/python_scripting.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2021-06-16 16:14:14 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2021-06-17 14:10:24 -0400
commitebb939ba0494648a7eb521023649816cd28be6c4 (patch)
treeda77637440bb65f26bcb05646fcb7396ddf97b8f /examples/python_scripting.py
parent525d32cfde6c2f9fecb0ee44972c18d4b0bf614f (diff)
downloadcmd2-git-ebb939ba0494648a7eb521023649816cd28be6c4.tar.gz
Updated all examples to use Cmd2ArgumentParser instead of argparse.ArgumentParser.
This is best practice for consistency of appearance between built-in and custom commands.
Diffstat (limited to 'examples/python_scripting.py')
-rwxr-xr-xexamples/python_scripting.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/python_scripting.py b/examples/python_scripting.py
index 7e729202..39787085 100755
--- a/examples/python_scripting.py
+++ b/examples/python_scripting.py
@@ -20,7 +20,6 @@ scripts inside a cmd2 application via the run_pyscript command and the
This application and the "examples/scripts/conditional.py" script serve as an
example for one way in which this can be done.
"""
-import argparse
import os
import cmd2
@@ -95,7 +94,7 @@ class CmdLineApp(cmd2.Cmd):
# Tab complete only directories
return self.path_complete(text, line, begidx, endidx, path_filter=os.path.isdir)
- dir_parser = argparse.ArgumentParser()
+ dir_parser = cmd2.Cmd2ArgumentParser()
dir_parser.add_argument('-l', '--long', action='store_true', help="display in long format with one item per line")
@cmd2.with_argparser(dir_parser, with_unknown_args=True)