diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-04-25 12:42:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-25 12:42:37 -0400 |
commit | d4653e6fccf0bc15d04075110769c11befb22819 (patch) | |
tree | a04ca95d6f67bae491f290cc71036d2a4f6b168c /examples/override_parser.py | |
parent | 9c7bbfa5bdbf8c8d81c0cd3c3cd5179d700de0b2 (diff) | |
parent | 9b78cf4913202995dcf065ecf5077bf16fa01f95 (diff) | |
download | cmd2-git-d4653e6fccf0bc15d04075110769c11befb22819.tar.gz |
Merge pull request #931 from python-cmd2/branching_strategy
Added info on SemVer and branching strategy to CONTRIBUTING.md
Diffstat (limited to 'examples/override_parser.py')
-rwxr-xr-x | examples/override_parser.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/override_parser.py b/examples/override_parser.py index eecb0e88..b6548388 100755 --- a/examples/override_parser.py +++ b/examples/override_parser.py @@ -10,12 +10,14 @@ The following code shows how to override it with your own parser class. # See the code for custom_parser.py. It simply defines a parser and calls cmd2.set_default_argument_parser() # with the custom parser's type. import argparse -argparse.cmd2_parser_module = 'examples.custom_parser' # Next import stuff from cmd2. It will import your module just before the cmd2.Cmd class file is imported # and therefore override the parser class it uses on its commands. from cmd2 import cmd2 +argparse.cmd2_parser_module = 'examples.custom_parser' + + if __name__ == '__main__': import sys app = cmd2.Cmd(use_ipython=True, persistent_history_file='cmd2_history.dat') |