summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
Commit message (Collapse)AuthorAgeFilesLines
* When passing a ns_provider to an argparse command, will now attempt to ↵Eric Lin2020-08-121-1/+49
| | | | resolve the correct CommandSet instance for self. If not, it'll fall back and pass in the cmd2 app
* Breaking change: Removed cmd2 app as a required second parameter toEric Lin2020-08-121-19/+12
| | | | | | CommandSet command functions (do_, complete_, help_). Renamed install_command_set and uninstall_command_set to register_command_set and unregister_command_set.
* 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-101-8/+38
| | | | | | 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-071-155/+175
| | | | | Changed alias and macro commands to use as_subcommand_to() decorator. Updated CommandSet subcommand example to use help and description text.
* Minor formatting fixes. Injecting a function into namespace objects before ↵Eric Lin2020-08-041-7/+8
| | | | passing to command handlers to access sub-command handlers
* Now maintains a command->CommandSet mapping and passes the CommandSetanselor2020-08-041-36/+104
| | | | | | | | | | | | | | | 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.
* 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
|
* Removed sub-class and instead patch argparse._SubParsersActionEric Lin2020-08-041-3/+3
|
* Suggested PR Fixes.Eric Lin2020-08-041-19/+15
| | | | | 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-041-5/+94
| | | | | | load/unload. Updated examples and documentation to include discussion of injectable sub-commands.
* updated importsEric Lin2020-08-041-3/+2
| | | | Added additional documentation
* Removed support for functions outside of CommandSetsEric Lin2020-08-041-74/+11
|
* 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
* Added more command validation. Moved some common behavior into private ↵Eric Lin2020-08-041-26/+49
| | | | functions.
* Fixes to sphinx generationEric Lin2020-08-041-1/+1
|
* Fixes issue with locating help_ annd complete_ functions when autoloading ↵Eric Lin2020-08-041-5/+27
| | | | | | command functions Adds handling of some edge cases. More thorough test coverage.
* add ability to remove commands and commandsetsEric Lin2020-08-041-4/+46
| | | | 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-041-4/+4
| | | | | | for CommandSet commands. Issue #943
* Initial implementation of modular command loadingEric Lin2020-08-041-2/+64
| | | | | | | | | | 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 type annotations for fields in cmd2.Cmd.Eric Lin2020-07-211-26/+27
| | | | | | | 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
|
* Merge branch 'master' into hint_bugKevin Van Brunt2020-06-011-24/+30
|\
| * 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-071-17/+25
| | | | | | | | | | 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-071-7/+7
| | | | | | | | Both exception classes have been added to the public API.
* | Updated argparse_completer to use TableCreator for the hint tableKevin Van Brunt2020-05-281-2/+2
|/
* Added info on semantic versioning and branching strategy to CONTRIBUTING.mdTodd Leonhardt2020-04-241-7/+4
| | | | | | | Also: - Added isort to Pipenv dev - Added setup.cfg to make it easy to run flake8, doc8, and isort directly from the command line without using invoke - Ran isort to sort includes
* Merge branch 'master' into table_creatorKevin Van Brunt2020-04-221-9/+8
|\
| * run_pyscript now passes a keyword arg to do_py instead of using a hidden ↵Kevin Van Brunt2020-04-211-9/+8
| | | | | | | | argparse flag
* | Merge branch 'master' into table_creatorKevin Van Brunt2020-04-221-20/+46
|\ \ | |/
| * Updated error textKevin Van Brunt2020-04-201-4/+2
| |
| * cmd2 now considers ipy a pyscript environmentKevin Van Brunt2020-04-201-8/+17
| |
| * Consistently use :raises: instead of :raises (make sure there is a trailing ↵Todd Leonhardt2020-04-201-3/+3
| | | | | | | | colon)
| * Fix doc buildTodd Leonhardt2020-04-201-1/+1
| |
| * ipy now returns its PyBridge's stop value so the main loop can know to stop. ↵Kevin Van Brunt2020-04-201-10/+29
| | | | | | | | This is consistent with the py command.
* | Updated docsKevin Van Brunt2020-04-221-2/+2
|/
* Removed exception handling around tempfile.TemporaryFile()Kevin Van Brunt2020-04-131-5/+1
|
* onecmd_plus_hooks() no longer handles updating any state data related to ↵Kevin Van Brunt2020-04-121-41/+40
| | | | | | redirection. For simplicity, it's all done in _redirect_output() and _restore_output().
* Simplfied _redirect_output() by raising exception instead of returning boolKevin Van Brunt2020-04-111-38/+34
|
* Simplified onecmd_plus_hooks by reducing number of calls to ↵Kevin Van Brunt2020-04-111-6/+6
| | | | _run_cmdfinalization_hooks()
* Made some optional arguments with defaults keyword-only.Kevin Van Brunt2020-04-111-3/+3
| | | | | Added unit test for echo argument to pyscript app() command. Removed _relative_load from hidden commands since that command was renamed.
* Removed the shebang from cmd2.py which was a hangover from when that file ↵Todd Leonhardt2020-04-081-1/+0
| | | | formerly had a __main__
* Updated commentKevin Van Brunt2020-03-261-1/+1
|