- version update to 2.4.0
Bug Fixes
Fixed issue in ansi.async_alert_str() which would raise IndexError if prompt was blank.
Fixed issue where tab completion was quoting argparse flags in some cases.
Enhancements
Added broader exception handling when enabling clipboard functionality via pyperclip.
Added PassThroughException to __init__.py imports.
cmd2 now uses pyreadline3 when running any version of Python on Windows
Improved memory usage in certain use cases of tables (e.g. nested colored tables)
Deletions (potentially breaking changes)
Deleted cmd2.fg and cmd2.bg which were deprecated in 2.3.0. Use cmd2.Fg and cmd2.Bg instead.
- python-mock is actually not required for build
OBS-URL: https://build.opensuse.org/request/show/960147
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cmd2?expand=0&rev=90
- update to 2.3.2:
* Fixed issue where a `ns_provider` could be passed `None`
instead of its correct `cmd2.Cmd` or `CommandSet` value.
* Fixed issue introduced in 2.3.0 with `AlternatingTable`, `BorderedTable`, and `SimpleTable` that caused
header alignment settings to be overridden by data alignment settings.
* `CompletionItems` now saves the original object from which it creates a string.
* Using `CompletionItems` as argparse choices is fully supported.
* `ArgparseCompleter` now does the following if a list of `CompletionItems`
was created with numerical types:
* Fixed `AttributeError` in `rl_get_prompt()` when prompt is `None`.
* Fixed bug where using choices on a Settable didn't verify that a valid choice had been entered.
* Fixed bug introduced in cmd2 2.0.0 in which `select()` converts return values to strings.
* Added settings to Column class which prevent a table from overriding existing styles in header
and/or data text. This allows for things like nesting an AlternatingTable in another AlternatingTable.
* AlternatingTable no longer automatically applies background color to borders. This was done to improve
appearance since the background color extended beyond the borders of the table.
* Added ability to colorize all aspects of `AlternatingTable`, `BorderedTable`, and `SimpleTable`.
* Added support for 8-bit/256-colors with the `cmd2.EightBitFg` and `cmd2.EightBitBg` classes.
* Added support for 24-bit/RGB colors with the `cmd2.RgbFg` and `cmd2.RgbBg` classes.
* Removed dependency on colorama.
* Changed type of `ansi.allow_style` from a string to an `ansi.AllowStyle` Enum class.
* To support the color upgrade, all cmd2 colors now inherit from either `ansi.FgColor` or `ansi.BgColor`.
Therefore, `ansi.style()` no longer accepts colors as strings.
OBS-URL: https://build.opensuse.org/request/show/936100
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cmd2?expand=0&rev=41
* Fixed issue where a `ns_provider` could be passed `None`
instead of its correct `cmd2.Cmd` or `CommandSet` value.
* Fixed issue introduced in 2.3.0 with `AlternatingTable`, `BorderedTable`, and `SimpleTable` that caused
header alignment settings to be overridden by data alignment settings.
* `CompletionItems` now saves the original object from which it creates a string.
* Using `CompletionItems` as argparse choices is fully supported.
* `ArgparseCompleter` now does the following if a list of `CompletionItems`
was created with numerical types:
* Fixed `AttributeError` in `rl_get_prompt()` when prompt is `None`.
* Fixed bug where using choices on a Settable didn't verify that a valid choice had been entered.
* Fixed bug introduced in cmd2 2.0.0 in which `select()` converts return values to strings.
* Added settings to Column class which prevent a table from overriding existing styles in header
and/or data text. This allows for things like nesting an AlternatingTable in another AlternatingTable.
* AlternatingTable no longer automatically applies background color to borders. This was done to improve
appearance since the background color extended beyond the borders of the table.
* Added ability to colorize all aspects of `AlternatingTable`, `BorderedTable`, and `SimpleTable`.
* Added support for 8-bit/256-colors with the `cmd2.EightBitFg` and `cmd2.EightBitBg` classes.
* Added support for 24-bit/RGB colors with the `cmd2.RgbFg` and `cmd2.RgbBg` classes.
* Removed dependency on colorama.
* Changed type of `ansi.allow_style` from a string to an `ansi.AllowStyle` Enum class.
* To support the color upgrade, all cmd2 colors now inherit from either `ansi.FgColor` or `ansi.BgColor`.
Therefore, `ansi.style()` no longer accepts colors as strings.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cmd2?expand=0&rev=88
- update to 2.2.0:
* Fixed extra space appended to each alias by "alias list" command
* New function `set_default_ap_completer_type()`
* Added `ArgumentParser.get_ap_completer_type()` and
`ArgumentParser.set_ap_completer_type()`.
* Added `ap_completer_type` keyword arg to `Cmd2ArgumentParser.__init__()`
which saves a call to `set_ap_completer_type()`. This keyword will also
work with `add_parser()` when creating subcommands if the base
command's parser is a `Cmd2ArgumentParser`.
* New function `register_argparse_argument_parameter()`
* Using `SimpleTable` in the output for the following commands
* Tab completion of `CompletionItems` now includes divider row
* Removed `--verbose` flag from set command since descriptions always show now.
* All cmd2 built-in commands now populate `self.last_result`.
* Argparse tab completer will complete remaining flag names if there are no
more positionals to complete.
* Updated `async_alert()` to account for `self.prompt` not matching Readline's
current prompt.
* Deleted ``set_choices_provider()`` and ``set_completer()`` which were
deprecated in 2.1.2
OBS-URL: https://build.opensuse.org/request/show/925761
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cmd2?expand=0&rev=40
* Fixed extra space appended to each alias by "alias list" command
* New function `set_default_ap_completer_type()`
* Added `ArgumentParser.get_ap_completer_type()` and
`ArgumentParser.set_ap_completer_type()`.
* Added `ap_completer_type` keyword arg to `Cmd2ArgumentParser.__init__()`
which saves a call to `set_ap_completer_type()`. This keyword will also
work with `add_parser()` when creating subcommands if the base
command's parser is a `Cmd2ArgumentParser`.
* New function `register_argparse_argument_parameter()`
* Using `SimpleTable` in the output for the following commands
* Tab completion of `CompletionItems` now includes divider row
* Removed `--verbose` flag from set command since descriptions always show now.
* All cmd2 built-in commands now populate `self.last_result`.
* Argparse tab completer will complete remaining flag names if there are no
more positionals to complete.
* Updated `async_alert()` to account for `self.prompt` not matching Readline's
current prompt.
* Deleted ``set_choices_provider()`` and ``set_completer()`` which were
deprecated in 2.1.2
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cmd2?expand=0&rev=87
- update to 2.1.2:
* Added the following accessor methods for cmd2-specific attributes to the `argparse.Action` class
* `get_choices_callable()`
* `set_choices_provider()`
* `set_completer()`
* `get_descriptive_header()`
* `set_descriptive_header()`
* `get_nargs_range()`
* `set_nargs_range()`
* `get_suppress_tab_hint()`
* `set_suppress_tab_hint()`
* Now that `set_choices_provider()` and `set_completer()` have been added as methods to the
`argparse.Action` class, the standalone functions of the same name will be removed in version
2.2.0. To update to the new convention, do the following:
* Change `set_choices_provider(action, provider)` to `action.set_choices_provider(provider)`
* Change `set_completer(action, completer)` to `action.set_completer(completer)`
* Fixed handling of argparse's default options group name which was changed in Python 3.10
* Restored `plugins` and `tests_isolated` directories to tarball published to PyPI for `cmd2` release
OBS-URL: https://build.opensuse.org/request/show/906726
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cmd2?expand=0&rev=39
* Added the following accessor methods for cmd2-specific attributes to the `argparse.Action` class
* `get_choices_callable()`
* `set_choices_provider()`
* `set_completer()`
* `get_descriptive_header()`
* `set_descriptive_header()`
* `get_nargs_range()`
* `set_nargs_range()`
* `get_suppress_tab_hint()`
* `set_suppress_tab_hint()`
* Now that `set_choices_provider()` and `set_completer()` have been added as methods to the
`argparse.Action` class, the standalone functions of the same name will be removed in version
2.2.0. To update to the new convention, do the following:
* Change `set_choices_provider(action, provider)` to `action.set_choices_provider(provider)`
* Change `set_completer(action, completer)` to `action.set_completer(completer)`
* Fixed handling of argparse's default options group name which was changed in Python 3.10
* Restored `plugins` and `tests_isolated` directories to tarball published to PyPI for `cmd2` release
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cmd2?expand=0&rev=86
- Update to version 2.0.1
Bug Fixes
* Exclude plugins and tests_isolated directories from tarball
published to PyPI for cmd2 release
- Update to version 2.0.0
Bug Fixes
* Fixed issue where history indexes could get repeated
* Fixed issue where TableCreator was tossing blank last line
* Corrected help text for alias command
Breaking Changes
* cmd2 2.0 supports Python 3.6+ (removed support for Python 3.5)
* Argparse Completion / Settables
+ Replaced choices_function / choices_method with
choices_provider.
+ Replaced completer_function / completer_method with completer.
+ ArgparseCompleter now always passes cmd2.Cmd or CommandSet
instance as the first positional
+ argument to choices_provider and completer functions.
* Moved basic_complete from utils into cmd2.Cmd class.
* Moved CompletionError to exceptions.py
* Namespace.__statement__ has been removed.
Use Namespace.cmd2_statement.get() instead.
* Removed --silent flag from alias/macro create since startup
scripts can be run silently.
* Removed --with_silent flag from alias/macro list since startup
scripts can be run silently.
* Removed with_argparser_and_unknown_args since it was deprecated
in 1.3.0.
* Renamed silent_startup_script to silence_startup_script for
clarity.
OBS-URL: https://build.opensuse.org/request/show/897994
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cmd2?expand=0&rev=82
- Update to version 1.5.0
* Fixed bug where setting always_show_hint=True did not show a
hint when completing Settables.
* Fixed bug in editor detection logic on Linux systems that do
not have which.
* Fixed bug in table creator where column headers with tabs
would result in an incorrect width calculation.
* Fixed FileNotFoundError which occurred when running history
--clear and no history file existed.
* Added silent_startup_script option to cmd2.Cmd.__init__().
If True, then the startup script's output will be suppressed.
Anything written to stderr will still display.
OBS-URL: https://build.opensuse.org/request/show/888322
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cmd2?expand=0&rev=80
- Update to 0.9.22:
- Fixed bug where a redefined ansi.style_error was not being
used in all cmd2 files
- Enabled line buffering when redirecting output to a file
- Added align_left(), align_center(), and align_right() to
utils.py. All 3 of these functions support ANSI escape
sequences and characters with display widths greater than 1.
They wrap align_text() which is also in utils.py.
- Fixed bug where pipe processes were not being stopped by Ctrl-C
- Added exception handling to account for non-standard Python
environments in which readline is not loaded dynamically from
a shared library file
- Added read_input() function that is used to read from stdin.
Unlike the Python built-in input(), it also has an argument
to disable tab completion while input is being entered.
- Added capability to override the argument parser class used
by cmd2 built-in commands. See override_parser.py example for
more details.
- Added end argument to pfeedback() to be consistent with the
other print functions like poutput().
- Added apply_style to pwarning().
- For consistency between all the print functions:
- Made end and chop keyword-only arguments of ppaged()
- end is always added to message in ppaged()
OBS-URL: https://build.opensuse.org/request/show/760618
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cmd2?expand=0&rev=30
- Fixed bug where a redefined ansi.style_error was not being
used in all cmd2 files
- Enabled line buffering when redirecting output to a file
- Added align_left(), align_center(), and align_right() to
utils.py. All 3 of these functions support ANSI escape
sequences and characters with display widths greater than 1.
They wrap align_text() which is also in utils.py.
- Fixed bug where pipe processes were not being stopped by Ctrl-C
- Added exception handling to account for non-standard Python
environments in which readline is not loaded dynamically from
a shared library file
- Added read_input() function that is used to read from stdin.
Unlike the Python built-in input(), it also has an argument
to disable tab completion while input is being entered.
- Added capability to override the argument parser class used
by cmd2 built-in commands. See override_parser.py example for
more details.
- Added end argument to pfeedback() to be consistent with the
other print functions like poutput().
- Added apply_style to pwarning().
- For consistency between all the print functions:
- Made end and chop keyword-only arguments of ppaged()
- end is always added to message in ppaged()
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cmd2?expand=0&rev=68
- fix previous commit
- Update to 0.9.12:
- Bug Fixes
- Fixed a bug in how redirection and piping worked inside
py or pyscript commands
- Fixed bug in async_alert where it didn't account for
prompts that contained newline characters
- Fixed path completion case when CWD is just a slash.
Relative path matches were incorrectly prepended with
a slash.
- Enhancements
- Added ability to include command name placeholders in
the message printed when trying to run a disabled
command.
- Added instance attributes to customize error messages
without having to override methods. Theses messages can
also be colored.
- The with_argparser decorators now add the Statement
object created when parsing the command line to the
argparse.Namespace object they pass to the do_*
methods. It is stored in an attribute called
__statement__.
- This can be useful if a command function needs to know
the command line for things like logging.
- Added a -t option to the load command for automatically
generating a transcript based on a script file
- When in a pyscript, the stdout and stderr streams of
shell commands and processes being piped to are now
captured and included in the CommandResult structure.
- Potentially breaking changes
- The following commands now write to stderr instead of
stdout when printing an error. This will make catching
errors easier in pyscript.
- Removed *** from beginning of error messages printed by
do_help() and default()
- Significantly refactored cmd.Cmd class so that all
class attributes got converted to instance attributes,
also: self.pipe_proc is now called
self.cur_pipe_proc_reader and is a ProcReader class.
- Shell commands and commands being piped to while in
a pyscript will function as if their output is going to
a pipe and not a tty. This was necessary to be able to
capture their output.
- fix build for SLE12 and older
OBS-URL: https://build.opensuse.org/request/show/699499
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cmd2?expand=0&rev=25
- fix previous commit
- Update to 0.9.12:
- Bug Fixes
- Fixed a bug in how redirection and piping worked inside
py or pyscript commands
- Fixed bug in async_alert where it didn't account for
prompts that contained newline characters
- Fixed path completion case when CWD is just a slash.
Relative path matches were incorrectly prepended with
a slash.
- Enhancements
- Added ability to include command name placeholders in
the message printed when trying to run a disabled
command.
- Added instance attributes to customize error messages
without having to override methods. Theses messages can
also be colored.
- The with_argparser decorators now add the Statement
object created when parsing the command line to the
argparse.Namespace object they pass to the do_*
methods. It is stored in an attribute called
__statement__.
- This can be useful if a command function needs to know
the command line for things like logging.
- Added a -t option to the load command for automatically
generating a transcript based on a script file
- When in a pyscript, the stdout and stderr streams of
shell commands and processes being piped to are now
captured and included in the CommandResult structure.
- Potentially breaking changes
- The following commands now write to stderr instead of
stdout when printing an error. This will make catching
errors easier in pyscript.
- Removed *** from beginning of error messages printed by
do_help() and default()
- Significantly refactored cmd.Cmd class so that all
class attributes got converted to instance attributes,
also: self.pipe_proc is now called
self.cur_pipe_proc_reader and is a ProcReader class.
- Shell commands and commands being piped to while in
a pyscript will function as if their output is going to
a pipe and not a tty. This was necessary to be able to
capture their output.
OBS-URL: https://build.opensuse.org/request/show/699492
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cmd2?expand=0&rev=50