summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-14 23:57:03 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-14 23:57:03 -0400
commit8d882f529f564bbb03769e2454a73a01984dc11b (patch)
tree6ab272d20086e93ca62e2a00fd07fa3eb9c94097 /cmd2
parentefe5310dca1ff45b7e6a8d9f579fcef1406f242d (diff)
downloadcmd2-git-8d882f529f564bbb03769e2454a73a01984dc11b.tar.gz
Renamed pyscript to run_pyscript
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/cmd2.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 301f1660..f9d6281f 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3241,16 +3241,21 @@ class Cmd(cmd.Cmd):
return bridge.stop
- pyscript_parser = ACArgumentParser()
- setattr(pyscript_parser.add_argument('script_path', help='path to the script file'),
+ run_pyscript_parser = ACArgumentParser()
+ setattr(run_pyscript_parser.add_argument('script_path', help='path to the script file'),
ACTION_ARG_CHOICES, ('path_complete',))
- setattr(pyscript_parser.add_argument('script_arguments', nargs=argparse.REMAINDER,
- help='arguments to pass to script'),
+ setattr(run_pyscript_parser.add_argument('script_arguments', nargs=argparse.REMAINDER,
+ help='arguments to pass to script'),
ACTION_ARG_CHOICES, ('path_complete',))
- @with_argparser(pyscript_parser)
- def do_pyscript(self, args: argparse.Namespace) -> bool:
+ @with_argparser(run_pyscript_parser)
+ def do_run_pyscript(self, args: argparse.Namespace) -> bool:
"""Run a Python script file inside the console"""
+ if args.__statement__.command == "pyscript":
+ self.perror("pyscript has been renamed and will be removed in the next release, "
+ "please use run_pyscript instead\n",
+ traceback_war=False, err_color=Fore.LIGHTYELLOW_EX)
+
script_path = os.path.expanduser(args.script_path)
py_return = False
@@ -3274,6 +3279,9 @@ class Cmd(cmd.Cmd):
return py_return
+ # pyscript is deprecated
+ do_pyscript = do_run_pyscript
+
# Only include the do_ipy() method if IPython is available on the system
if ipython_available: # pragma: no cover
@with_argparser(ACArgumentParser())
@@ -3647,7 +3655,7 @@ class Cmd(cmd.Cmd):
:return: True if running of commands should stop
"""
if args.__statement__.command == "load":
- self.perror("load has been renamed and will be removed in the next release,"
+ self.perror("load has been renamed and will be removed in the next release, "
"please use run_script instead\n",
traceback_war=False, err_color=Fore.LIGHTYELLOW_EX)