summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-10-02 13:24:18 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-10-02 13:24:18 -0400
commitd9f5f2b48927a43a5628bff856f90ad0d8b80c7e (patch)
tree7476ab84611cb5175a03116f017a85cac27be31b /cmd2/cmd2.py
parent924f8a57a73de7da462e654f3937b134ca92dbc7 (diff)
downloadcmd2-git-d9f5f2b48927a43a5628bff856f90ad0d8b80c7e.tar.gz
Added echo parameter for calling commands from Pyscript
Documented py command's parsing limitations
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index e04138fa..324daf93 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2944,7 +2944,21 @@ class Cmd(cmd.Cmd):
sys.displayhook = sys.__displayhook__
sys.excepthook = sys.__excepthook__
- py_parser = ACArgumentParser()
+ py_description = ("Invoke Python command or shell\n"
+ "\n"
+ "When invoking a command directly from the command line, note this shell has\n"
+ "limited ability to parse Python statements into tokens. If an opening quote is\n"
+ "not preceded by whitespace, its closing quote should appear before any\n"
+ "whitespace. Otherwise whitespace in the parsed tokens will get lost.\n"
+ "\n"
+ "Note the opening quote before 'This' in the following commands\n"
+ 'py print("This " + "is bad")\n'
+ 'py print("This" + " is good")\n'
+ "\n"
+ "If you see strange parsing behavior, its best to just open the Python shell by\n"
+ "providing no arguments to py and run more complex statements there.")
+
+ py_parser = ACArgumentParser(description=py_description)
py_parser.add_argument('command', help="command to run", nargs='?')
py_parser.add_argument('remainder', help="remainder of command", nargs=argparse.REMAINDER)