summaryrefslogtreecommitdiff
path: root/cmd2/argparse_completer.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-10-05 13:32:04 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-10-05 13:32:04 -0400
commit734796b895bb85d67c651d9e8e8bf71e7d60b7e3 (patch)
tree5879270409a4992622da2933275ccaae30525ee6 /cmd2/argparse_completer.py
parent49cbec9969b4b53248d6097d8f395d92c74f7228 (diff)
downloadcmd2-git-734796b895bb85d67c651d9e8e8bf71e7d60b7e3.tar.gz
Using sub-command instead of subcommand where possible to be consistent with argparse
Diffstat (limited to 'cmd2/argparse_completer.py')
-rwxr-xr-xcmd2/argparse_completer.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py
index ad2c520b..c900a780 100755
--- a/cmd2/argparse_completer.py
+++ b/cmd2/argparse_completer.py
@@ -917,6 +917,13 @@ class ACArgumentParser(argparse.ArgumentParser):
self._custom_error_message = custom_message
# End cmd2 customization
+ def add_subparsers(self, **kwargs):
+ """Custom override. Sets a default title if one was not given."""
+ if 'title' not in kwargs:
+ kwargs['title'] = 'sub-commands'
+
+ return super().add_subparsers(**kwargs)
+
def error(self, message: str) -> None:
"""Custom error override. Allows application to control the error being displayed by argparse"""
if len(self._custom_error_message) > 0: