summaryrefslogtreecommitdiff
path: root/cmd2
Commit message (Collapse)AuthorAgeFilesLines
* Adding explicit python 3.5.3 test to nox, travis.Eric Lin2020-08-101-1/+10
| | | | Copied 3.5.4 definition of typing.Deque
* Updated with missing doc-string for new CommandSet parameters for cmd2.Cmd's ↵Eric Lin2020-08-101-0/+8
| | | | constructor
* Will now traverse down CommandSet inheritance tree to find all leaf descendants.1.3.2Eric Lin2020-08-102-9/+43
| | | | | | CommandSet now has a check to ensure it is only registered with one cmd2.Cmd instance at a time. Adds function to find command set by type and by command name
* Moved a comment to better section off codeKevin Van Brunt2020-08-071-8/+8
|
* Removed unnecessary prog value from subcommand parsersKevin Van Brunt2020-08-071-6/+6
|
* Moved code which copies subparser's settings to _register_subcommands().Kevin Van Brunt2020-08-073-179/+181
| | | | | Changed alias and macro commands to use as_subcommand_to() decorator. Updated CommandSet subcommand example to use help and description text.
* Fixed prog value of subcommands added with as_subcommand_to() decorator.Kevin Van Brunt2020-08-071-9/+30
| | | | Fixed missing settings in subcommand parsers created with as_subcommand_to() decorator.
* Verify that a completer function is defined in a CommandSet beforeEric Lin2020-08-064-10/+75
| | | | | | | | | | 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
* Marked with_arparser_and_unknown_args deprecated and consolidatedEric Lin2020-08-041-64/+33
| | | | implementation as an option to with_argparser instead.
* Minor formatting fixes. Injecting a function into namespace objects before ↵Eric Lin2020-08-045-8/+25
| | | | passing to command handlers to access sub-command handlers
* Now maintains a command->CommandSet mapping and passes the CommandSetanselor2020-08-046-55/+168
| | | | | | | | | | | | | | | through to the ArgparseCompleter if one is registered. For subcommands, the registered argparse instance for the subcommand is now tagged with the CommandSet from which it originated. If a CommandSet is detected, it's now passed in as 'self' for the completion functions. Fixes some issue found with removing a subcommand. Adds additional tests. Added a check to prevent removal of a CommandSet if it has commands with sub-commands from another CommandSet bound to it. Documentation improvements. Standardized around using CommandSetRegistrationException during commandset install/uninstall related errors. Added support for nested sub-command injection.
* Updated documentationKevin Van Brunt2020-08-041-2/+10
|
* Updated documentationKevin Van Brunt2020-08-041-1/+5
|
* Added handling for disabled commands to CommandSet functionsKevin Van Brunt2020-08-041-6/+19
|
* Fixes to how command callables are filtered from CommandSetEric Lin2020-08-041-4/+5
|
* Fixed issue where we attempted to remove CommandSet from a list it was not inKevin Van Brunt2020-08-041-1/+2
|
* Fixed typo in documentationKevin Van Brunt2020-08-041-3/+3
|
* Removed sub-class and instead patch argparse._SubParsersActionEric Lin2020-08-042-27/+29
|
* Suggested PR Fixes.Eric Lin2020-08-044-27/+35
| | | | | sub-commande => subcommand Added help/aliases to `as_subcommand_to` decorator.
* Adds unit tests for sub-commands and additional commandset edge casesEric Lin2020-08-041-12/+17
|
* Adds support for injectable subcommands as part of CommandSetEric Lin2020-08-045-8/+160
| | | | | | load/unload. Updated examples and documentation to include discussion of injectable sub-commands.
* updated importsEric Lin2020-08-043-5/+7
| | | | Added additional documentation
* Updates the example to remove usage of the now remove ability toEric Lin2020-08-041-5/+26
| | | | | | | | | | register arbitrary functions as commands. Added example that demonstrates use of each of the command decorators with CommandSets. Adds unit test that verifies that CommandSets containing decorators load and process commands correctly. Updated the constructor declaration for Cmd2ArgumentParser to explicitly re-declare argparse constructor parameters.
* Removed support for functions outside of CommandSetsEric Lin2020-08-043-100/+12
|
* added additional documentation for new decorator behaviorEric Lin2020-08-041-3/+24
|
* Added an additional check for isinstance(method, Callable) since there are ↵Eric Lin2020-08-041-1/+2
| | | | scenarios where inspect.ismethod() fails for some reason
* Adjusted decorators to accept variable positional parametersEric Lin2020-08-041-18/+41
|
* Sort imports using isortTodd Leonhardt2020-08-041-7/+2
|
* Appears to be a type hinting olution that works for flake, sphinx, and PyCharmEric Lin2020-08-041-8/+11
|
* Added more command validation. Moved some common behavior into private ↵Eric Lin2020-08-042-27/+50
| | | | functions.
* Fixes to sphinx generationEric Lin2020-08-042-2/+2
|
* Fixes issue with locating help_ annd complete_ functions when autoloading ↵Eric Lin2020-08-042-26/+35
| | | | | | command functions Adds handling of some edge cases. More thorough test coverage.
* add ability to remove commands and commandsetsEric Lin2020-08-042-5/+54
| | | | Issue #943
* Added new constructor parameter to flag whether commands should autoload. ↵Eric Lin2020-08-041-31/+83
| | | | | | Added unit tests. Moved installing commands into separate functions that can be called Issue #943
* Some minor cleanup of how imports work. Fixed issue with help documentation ↵Eric Lin2020-08-043-7/+23
| | | | | | for CommandSet commands. Issue #943
* Initial implementation of modular command loadingEric Lin2020-08-042-2/+186
| | | | | | | | | | Issue #943 New class CommandSet can be used to tag a class as a command class. If the constructor is simple, the object will automatically be instantiated and loaded. New register_command decorator to tag any arbitrary function as a command.
* Added 'no cover' for code block which cannot be tested in our unit testsKevin Van Brunt2020-08-031-1/+1
|
* Added type annotations for fields in cmd2.Cmd.Eric Lin2020-07-212-27/+29
| | | | | | | 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.
* Fixed hook documentationKevin Van Brunt2020-07-171-4/+4
|
* Added PyCharm warning suppressionsTodd Leonhardt2020-07-131-0/+2
|
* small simplificationTodd Leonhardt2020-07-131-2/+1
|
* slight cleanupTodd Leonhardt2020-07-131-2/+2
|
* Address fact that typing.Deque wasn't defined prior to 3.5.4Todd Leonhardt2020-07-131-1/+9
|
* replace pkg_resources with importlib.metadataDoug Hellmann2020-07-121-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Removed divider row from tab completion hint tableKevin Van Brunt2020-06-011-1/+1
|
* Optimized importsKevin Van Brunt2020-06-011-2/+1
|
* Merge branch 'master' into hint_bugKevin Van Brunt2020-06-013-29/+53
|\
| * Removed pwarning() calls when command raises SystemExitKevin Van Brunt2020-05-281-2/+0
| | | | | | | | Added unit tests
| * Made following changes to onecmd_plus_hooks()Kevin Van Brunt2020-05-072-21/+29
| | | | | | | | | | 1. Added SystemExit handling by warning the user it's occured and setting stop to True 2. KeyboardInterrupts won't be raised if stop is already set to True.
| * Added SkipPostcommandHooks exception and made Cmd2ArgparseError inherit from it.Kevin Van Brunt2020-05-073-12/+30
| | | | | | | | Both exception classes have been added to the public API.