| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
in __init__.py
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
# Conflicts:
# cmd2/__init__.py
# cmd2/argparse_completer.py
# cmd2/argparse_custom.py
# cmd2/cmd2.py
# cmd2/decorators.py
# cmd2/exceptions.py
# cmd2/utils.py
# examples/arg_decorators.py
# examples/argparse_completion.py
# examples/modular_commands_main.py
# tests/test_argparse_completer.py
# tests/test_argparse_custom.py
# tests/test_cmd2.py
# tests/test_completion.py
# tests/test_history.py
|
| | | |
|
| | | |
|
| | | |
|
| | |\ |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Replaced completer_function / completer_method with completer.
ArgparseCompleter now always passes cmd2.Cmd or CommandSet instance as the self
argument to choices_provider and completer functions.
Moved basic_complete from utils into cmd2.Cmd class.
Moved CompletionError to exceptions.py
|
| | |/
|/| |
|
| |/
|
|
|
|
|
| |
are now
Cmd2AttributeWrapper objects named cmd2_statement and cmd2_handler. This makes it
easy to filter out which attributes in an argparse.Namespace were added by cmd2.
|
| |
|
|
|
|
|
|
|
|
| |
passing it a CommandSet instance.
Search for a CommandSet instance that matches the completer's parent
class type.`
Resolves Issue #967
Renamed isolated_tests directory to tests_isolated for better visual grouping. Added some exception documentation
|
| |
|
|
|
|
| |
load/unload.
Updated examples and documentation to include discussion of injectable
sub-commands.
|
| | |
|
| |
|
|
|
|
| |
for CommandSet commands.
Issue #943
|
| |
|
|
|
|
|
| |
Cleaned up docstring in external test plugin
Updated some initialization to match new approach for version info discovery.
Tagged some IDE-only lines as no-cover
Adds plugin coverage reporting.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Importing pkg_resources has a side-effect of scanning every installed
distribution on sys.path to load the metadata, especially the entry
points defined in the packages. This can have a significant
launch-time cost for command line applications when there are a lot of
distributions to scan.
Since cmd2 is only using pkg_resources to find the version of the
installed package, pkg_resources can be replaced with
importlib.metadata. The implementation in the new library is
significantly faster because it goes immediately to the metadata file
for the requested distribution, instead of scanning all of them. There
are also no import-time side-effects.
importlib.metadata is a new standard library module starting with
python 3.8. For earlier versions, a compatible library has been
released to PyPI as 'importlib_metadata'. This change adds the new
dependency with a qualifier so that it is only applied to older
versions of python, and then updates the places that were importing
pkg_resources to look for the different versions of the new library
instead. The documentation configuration is changed to import cmd2
itself to get its version, since the package has to be installed for
the metadata to be available anyway.
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
|
| |
|
|
| |
Both exception classes have been added to the public API.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
colors which style() can now optionally use
This is to make it easier to autocomplete color names in an IDE
|
| | |
|
| |
|
|
| |
commands
|
| |
|
|
|
| |
This includes moving cmd2 decorators into a new file called decorators.py
Moved some constants from cmd2.py to constants.py
|
| | |
|
| | |
|
| |
|
|
|
|
| |
class of argparse.ArgumentParser
when developers read the code in cmd2.py.
|
| | |
|
| |
|
|
|
|
|
| |
argparse_custom.py.
Lazy loading AutoCompleter in cmd2 instance methods to allow argparse_completer.py to import
cmd2.Cmd class. This Architecture makes more sense because AutoCompleter depends on cmd2.Cmd.
|
| |
|
|
|
| |
Also:
- Fixed an example in README which was using print() instead of self.poutput()
|
| |
|
|
| |
from cmd2.py to constants.py
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit contains a very large number of trivial changes in order to fix flake8 errors and warnings. Predominantly these are whitespace changes.
Additionally, the build for Python 3.7 on TravisCI has been tweaked to fail if there are any flake8 errors using the following commandline:
* flake8 . --count --ignore=E252 --max-complexity=31 --max-line-length=127 --show-source --statistics
NOTE: In the future the max cyclomatic complexity should be lowered, but some improvements need to be made first.
One flake8 error is being ignored entirely:
* E252 missing whitespace around parameter equals
* ignored because it doesn't correctly deal with default argument values after a type hint
A few flake8 errors are being selectively ignored in certain files:
* C901 fuction is too complex
* ignored in argparse_completer.py because the complex code is an override of argparse complexity
* E302 expected 2 blank lines after ...
* ignored in all unit test files for convenience
* F401 module imported but unused
* ignored in cmd2/__init__.py because imports are for convenience of cmd2 developers and backwards compatibility
* F821 undefined name
* ignored in cmd2 script files which are intended to run only within cmd2 applications via pyscript where "app" and "cmd" are defined
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
These classes are subtly different, particularly in terms of their truthiness.
CmdResult
- attributes: out, err, war
- truthy: if err is falsy
CommandResult
- attributes: stdout, stderr, data
- truthy: if err is falsy AND data is not None
So CmdResult was oriented to provide essentially info, error, and warning messages to the user (typically as stirngs), whereas CommandResult is geared towards providing info and error messages to the user as strings in addition to data to the user in a command-specific format which is arbitrary other than it should never be None if the command succeeds.
|
| |
|
|
|
| |
Also:
- Refactored perror() to remove a rarely used optional argument which was unecessary
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |\
| |
| |
| | |
Updated argcomplete_bridge to use new constants/utils.
|
| | |
| |
| |
| |
| |
| |
| | |
Added some shared definitions to cmd2/__init__.py -> maybe there's a better place for these?
Figured out how to trick bash into showing argument hints. It's a bit weird.
Updated all of the tests and examples to import cmd2 resources from their new location without the automatic imports in cmd2/__init__.py
For #369
|
| |/ |
|
| |
|
|
|
| |
Removed things which were only needed for unit tests from __init__.py
- Converted to importing from cmd2.cmd2.<foo> within the relevant unit tests
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
This reverts commit 4a3d01b679c5db7f6cb670ca981a953eb3b98dc5.
|
|
|
Still have a fair amount of work to do to get this sorted.
|