diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-08-24 15:11:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-24 15:11:25 -0400 |
commit | 42094e0d43c1a7373f4ed96d8d72dcf16f77a5f6 (patch) | |
tree | c517504559b45aff02e0d1da86d1ee30ef4454b7 /cmd2/cmd2.py | |
parent | 8c0abd3c1adb204737851c06cb9eeba16791f2c4 (diff) | |
parent | a5d4c71072ecb9a4c07fb88a8694726eaf5400a7 (diff) | |
download | cmd2-git-42094e0d43c1a7373f4ed96d8d72dcf16f77a5f6.tar.gz |
Merge pull request #508 from python-cmd2/ac_parser
ACHelpFormatter now inherits from argparse.RawTextHelpFormatter
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index a17e128f..c49ec0cc 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2556,18 +2556,19 @@ Usage: Usage: unalias [-a] name [name ...] else: raise LookupError("Parameter '%s' not supported (type 'set' for list of parameters)." % param) - set_parser = ACArgumentParser(formatter_class=argparse.RawTextHelpFormatter) + set_description = "Sets a settable parameter or shows current settings of parameters.\n" + set_description += "\n" + set_description += "Accepts abbreviated parameter names so long as there is no ambiguity.\n" + set_description += "Call without arguments for a list of settable parameters with their values." + + set_parser = ACArgumentParser(description=set_description) set_parser.add_argument('-a', '--all', action='store_true', help='display read-only settings as well') set_parser.add_argument('-l', '--long', action='store_true', help='describe function of parameter') set_parser.add_argument('settable', nargs=(0, 2), help='[param_name] [value]') @with_argparser(set_parser) def do_set(self, args: argparse.Namespace) -> None: - """Sets a settable parameter or shows current settings of parameters. - - Accepts abbreviated parameter names so long as there is no ambiguity. - Call without arguments for a list of settable parameters with their values. - """ + """Sets a settable parameter or shows current settings of parameters""" try: param_name, val = args.settable val = val.strip() @@ -2882,7 +2883,7 @@ Paths or arguments that contain spaces must be enclosed in quotes embed(banner1=banner, exit_msg=exit_msg) load_ipy(bridge) - history_parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) + history_parser = ACArgumentParser() history_parser_group = history_parser.add_mutually_exclusive_group() history_parser_group.add_argument('-r', '--run', action='store_true', help='run selected history items') history_parser_group.add_argument('-e', '--edit', action='store_true', |