Releases: python-cmd2/cmd2
Releases · python-cmd2/cmd2
1.3.6 (August 27, 2020)
- Breaking changes
- The functions cmd2 adds to Namespaces (
get_statement()
andget_handler()
) are nowCmd2AttributeWrapper
objects namedcmd2_statement
andcmd2_handler
. This makes it easy to filter out which attributes in anargparse.Namespace
were added bycmd2
.
- The functions cmd2 adds to Namespaces (
- Deprecations
Namespace.__statement__
will be removed incmd2
2.0.0. UseNamespace.cmd2_statement.get()
going forward.
1.3.5 (August 25, 2020)
- Bug Fixes
- Fixed
RecursionError
when printing anargparse.Namespace
caused by custom attribute cmd2 was adding
- Fixed
- Enhancements
- Added
get_statement()
function toargparse.Namespace
which returns__statement__
attribute
- Added
1.3.4 (August 20, 2020)
- Bug Fixes
- Fixed
AttributeError
whenCommandSet
that usesas_subcommand_to
decorator is loaded duringcmd2.Cmd.__init__()
.
- Fixed
- Enhancements
- Improved exception messages when using mock without
spec=True
. See testing documentation for more details on testing cmd2-based applications with mock.
- Improved exception messages when using mock without
1.3.3 (August 13, 2020)
1.3.3 (August 13, 2020)
- Breaking changes
- CommandSet command functions (do_, complete_, help_) will no longer have the cmd2 app passed in as the first parameter after
self
since this is already a class member. - Renamed
install_command_set()
anduninstall_command_set()
toregister_command_set()
andunregister_command_set()
for better name consistency.
- CommandSet command functions (do_, complete_, help_) will no longer have the cmd2 app passed in as the first parameter after
- Bug Fixes
- Fixed help formatting bug in
Cmd2ArgumentParser
whenmetavar
is a tuple - Fixed tab completion bug when using
CompletionItem
on an argument whosemetavar
is a tuple - Added explicit testing against python 3.5.2 for Ubuntu 16.04, and 3.5.3 for Debian 9
- Added fallback definition of typing.Deque (taken from 3.5.4)
- Removed explicit type hints that fail due to a bug in 3.5.2 favoring comment-based hints instead
- When passing a ns_provider to an argparse command, will now attempt to resolve the correct CommandSet instance for self. If not, it'll fall back and pass in the cmd2 app
- Fixed help formatting bug in
- Other
- Added missing doc-string for new cmd2.Cmd init parameters introduced by CommandSet enhancement
1.3.2 (August 10, 2020)
- Bug Fixes
- Fixed
prog
value of subcommands added withas_subcommand_to()
decorator. - Fixed missing settings in subcommand parsers created with
as_subcommand_to()
decorator. These settings
include things like description and epilog text. - Fixed issue with CommandSet auto-discovery only searching direct sub-classes
- Fixed
- Enhancements
- Added functions to fetch registered CommandSets by type and command name
1.3.1 (August 6, 2020)
- Bug Fixes
- Fixed issue determining whether an argparse completer function required a reference to a containing
CommandSet. Also resolves issues determining the correct CommandSet instance when calling the argparse
argument completer function. Manifested as a TypeError when usingcmd2.Cmd.path_complete
as a completer
for an argparse-based command defined in a CommandSet
- Fixed issue determining whether an argparse completer function required a reference to a containing
1.3.0 (August 4, 2020)
- Enhancements
- Added CommandSet - Enables defining a separate loadable module of commands to register/unregister with your cmd2 application.
- Other
- Marked with_argparser_and_unknown_args pending deprecation and consolidated implementation into with_argparser
1.2.1 (July 14, 2020)
- Bug Fixes
- Relax minimum version of
importlib-metadata
to >= 1.6.0 when using Python < 3.8
- Relax minimum version of
1.2.0 (July 13, 2020)
- Bug Fixes
- Fixed
typing
module compatibility issue with Python 3.5 prior to 3.5.4
- Fixed
- Enhancements
- Switched to getting version using
importlib.metadata
instead of usingpkg_resources
- Improves
cmd2
application launch time on systems that have a lot of Python packages onsys.path
- Added dependency on
importlib_metadata
when running on versions of Python prior to 3.8
- Improves
- Switched to getting version using
1.1.0 (June 6, 2020)
- Bug Fixes
- Fixed issue where subcommand usage text could contain a subcommand alias instead of the actual name
- Fixed bug in
ArgparseCompleter
wherefill_width
could become negative iftoken_width
was large
relative to the terminal width.
- Enhancements
- Made
ipy
consistent withpy
in the following waysipy
returns whether any of the commands run in it returned True to stop command loopCmd.in_pyscript()
returns True while inipy
.- Starting
ipy
whenCmd.in_pyscript()
is already True is not allowed.
with_argument_list
,with_argparser
, andwith_argparser_and_unknown_args
wrappers now pass
kwargs
through to their wrapped command function.- Added
table_creator
module for creating richly formatted tables. This module is in beta and subject
to change.- See table_creation
documentation for an overview. - See table_creation.py
for an example.
- See table_creation
- Added the following exceptions to the public API
SkipPostcommandHooks
- Custom exception class for when a command has a failure bad enough to skip
post command hooks, but not bad enough to print the exception to the user.Cmd2ArgparseError
- ASkipPostcommandHooks
exception for when a command fails to parse its arguments.
Normally argparse raises aSystemExit
exception in these cases. To avoid stopping the command
loop, catch theSystemExit
and raise this instead. If you still need to run post command hooks
after parsing fails, just return instead of raising an exception.
- Added explicit handling of
SystemExit
. If a command raises this exception, the command loop will be
gracefully stopped.
- Made