diff options
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | cmd2/argparse_custom.py | 9 | ||||
-rw-r--r-- | cmd2/utils.py | 5 | ||||
-rw-r--r-- | docs/conf.py | 2 |
4 files changed, 15 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 20289e3c..65578f66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.1 (TBD, 2021) +* Bug Fixes + * Fixed handling of argparse's default options group name which was changed in Python 3.10 + ## 2.1.0 (June 14, 2021) * Enhancements * Converted persistent history files from pickle to compressed JSON diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py index 4ba05985..7b72be9f 100644 --- a/cmd2/argparse_custom.py +++ b/cmd2/argparse_custom.py @@ -975,7 +975,12 @@ class Cmd2ArgumentParser(argparse.ArgumentParser): # positionals, optionals and user-defined groups for action_group in self._action_groups: - if action_group.title == 'optional arguments': + if sys.version_info >= (3, 10): + default_options_group = action_group.title == 'options' + else: + default_options_group = action_group.title == 'optional arguments' + + if default_options_group: # check if the arguments are required, group accordingly req_args = [] opt_args = [] @@ -992,7 +997,7 @@ class Cmd2ArgumentParser(argparse.ArgumentParser): formatter.end_section() # now display truly optional arguments - formatter.start_section(action_group.title) + formatter.start_section('optional arguments') formatter.add_text(action_group.description) formatter.add_arguments(opt_args) formatter.end_section() diff --git a/cmd2/utils.py b/cmd2/utils.py index cbbd1800..fd2898ad 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -131,8 +131,9 @@ class Settable: validation using str_to_bool(). The val_type function should raise an exception if it fails. This exception will be caught and printed by Cmd.do_set(). :param description: string describing this setting - :param settable_object: Object to configure with the set command - :param settable_attrib_name: Attribute name to be modified. Defaults to `name` if not specified. + :param settable_object: object to which the instance attribute belongs (e.g. self) + :param settable_attrib_name: name which displays to the user in the output of the set command. + Defaults to `name` if not specified. :param onchange_cb: optional function or method to call when the value of this settable is altered by the set command. (e.g. onchange_cb=self.debug_changed) diff --git a/docs/conf.py b/docs/conf.py index 53e3c955..6f0c025d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -52,7 +52,7 @@ master_doc = 'index' # General information about the project. project = 'cmd2' -copyright = '2010-2020, cmd2 contributors' +copyright = '2010-2021, cmd2 contributors' author = 'cmd2 contributors' # The version info for the project you're documenting, acts as replacement for |