diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-28 15:01:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-28 15:01:10 -0400 |
commit | 87fdda149ade5c82d853334c87db0a2d11445594 (patch) | |
tree | ae42eff9d6a906550c5a4f83144b4bbd6d04dba5 /examples/arg_print.py | |
parent | bb8f6dd930820ef580d3399726256ac0a19a78dc (diff) | |
parent | 2cbc5cf234a353b94740f167b5b8564bbd2fc900 (diff) | |
download | cmd2-git-87fdda149ade5c82d853334c87db0a2d11445594.tar.gz |
Merge pull request #550 from python-cmd2/macro
Added macros
Diffstat (limited to 'examples/arg_print.py')
-rwxr-xr-x | examples/arg_print.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/arg_print.py b/examples/arg_print.py index 4f0ca709..f2168126 100755 --- a/examples/arg_print.py +++ b/examples/arg_print.py @@ -2,13 +2,12 @@ # coding=utf-8 """A simple example demonstrating the following: 1) How arguments and options get parsed and passed to commands - 2) How to change what syntax get parsed as a comment and stripped from - the arguments + 2) How to change what syntax gets parsed as a comment and stripped from the arguments This is intended to serve as a live demonstration so that developers can experiment with and understand how command and argument parsing work. -It also serves as an example of how to create command aliases (shortcuts). +It also serves as an example of how to create shortcuts. """ import argparse @@ -18,7 +17,7 @@ class ArgumentAndOptionPrinter(cmd2.Cmd): """ Example cmd2 application where we create commands that just print the arguments they are called with.""" def __init__(self): - # Create command aliases which are shorter + # Create command shortcuts which are typically 1 character abbreviations which can be used in place of a command self.shortcuts.update({'$': 'aprint', '%': 'oprint'}) # Make sure to call this super class __init__ *after* setting and/or updating shortcuts |