summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2')
-rwxr-xr-xcmd2/argparse_completer.py5
-rw-r--r--cmd2/cmd2.py15
2 files changed, 9 insertions, 11 deletions
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py
index 1479a6bf..0e241cd9 100755
--- a/cmd2/argparse_completer.py
+++ b/cmd2/argparse_completer.py
@@ -695,7 +695,7 @@ class AutoCompleter(object):
# noinspection PyCompatibility,PyShadowingBuiltins,PyShadowingBuiltins
-class ACHelpFormatter(argparse.HelpFormatter):
+class ACHelpFormatter(argparse.RawTextHelpFormatter):
"""Custom help formatter to configure ordering of help text"""
def _format_usage(self, usage, actions, groups, prefix) -> str:
@@ -870,9 +870,6 @@ class ACHelpFormatter(argparse.HelpFormatter):
result = super()._format_args(action, default_metavar)
return result
- def _split_lines(self, text: str, width) -> List[str]:
- return text.splitlines()
-
# noinspection PyCompatibility
class ACArgumentParser(argparse.ArgumentParser):
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 58972232..2303e86c 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2553,18 +2553,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()
@@ -2879,7 +2880,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',