summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate support for Python 3.6 and remove dependency on attrs (#1257)Todd Leonhardt2023-01-312-2/+0
| | | | | | | | | | | | | * Start deprecation of Python 3.6 * Removed dependency on attrs and replaced with dataclasses * Fix typing * Added comments to assist with dropping support of Python versions in the future. --------- Co-authored-by: Kevin Van Brunt <kmvanbrunt@gmail.com>
* Moved documentation annotation stripping into utility function. Changed ↵Eric Lin2022-04-251-1/+5
| | | | argparse decorator to automatically strip annotations.
* Fixed formatting errorKevin Van Brunt2022-04-131-1/+1
|
* Add an educational postcommand hookCase Ploeg2022-04-131-1/+14
| | | | | Not necessary for the sake of the example, but might help some curious individuals get a better feel for how the system works.
* update postparsing hooksCase Ploeg2022-04-131-6/+8
| | | | | | | | | Previously redirection information was lost by the postparsing hooks add_whitespace_hook() and downcase_hook(). This was fine for this simple shell, but sets a bad example for more complicated use cases. To fix this, when parsing the new Statement object, include the `post_command` attribute from the original Statement.
* Use latest version of black (#1201)Todd Leonhardt2022-02-151-1/+1
|
* Added ability to set border background color on BorderTables and ↵Kevin Van Brunt2021-11-101-14/+70
| | | | AlternatingTables
* Updated table example.Kevin Van Brunt2021-10-261-47/+60
| | | | | | Renamed Column settings: override_header_style -> style_header_text override_data_style -> style_data_text
* Added ability to colorize all aspects of SimpleTablesKevin Van Brunt2021-10-251-33/+153
|
* Added support for 8-bit/256-colors with the cmd2.EightBitFg and ↵Kevin Van Brunt2021-10-188-180/+44
| | | | | | | | | | | | | | cmd2.EightBitBg classes. Added support for 24-bit/RGB colors with the cmd2.RgbFg and cmd2.RgbBg classes. Removed dependency on colorama. Deprecated cmd2.fg. Use cmd2.Fg instead. Deprecated cmd2.bg. Use cmd2.Bg instead. Changed type of ansi.allow_style from a string to an ansi.AllowStyle Enum class. Fixed bug where using choices on a Settable didn't verify that a valid choice had been entered.
* Fixed example codeKevin Van Brunt2021-09-071-2/+5
|
* Refactored custom ArgparseCompleter functionality so they will now be set ↵Kevin Van Brunt2021-09-012-3/+3
| | | | | | using methods on ArgumentParser objects. This fixes issue where subcommands did not use the correct custom ArgparseCompleter type.
* Updated documentation for setting custom parsersKevin Van Brunt2021-08-232-2/+4
|
* * New function `set_default_command_completer_type()` allows developer to ↵Eric Lin2021-08-231-3/+2
| | | | | | | | | extend and modify the behavior of `ArgparseCompleter`. * New function `register_argparse_argument_parameter()` allows developers to specify custom parameters to be passed to the argparse parser's `add_argument()` method. These parameters will become accessible in the resulting argparse Action object when modifying `ArgparseCompleter` behavior.
* Fixed spelling in docstringKevin Van Brunt2021-06-281-1/+1
|
* Updated all examples to use Cmd2ArgumentParser instead of ↵Kevin Van Brunt2021-06-1711-26/+18
| | | | | | argparse.ArgumentParser. This is best practice for consistency of appearance between built-in and custom commands.
* Style changes from running black on Python 3.9Kevin Van Brunt2021-04-2713-19/+19
|
* Renamed use_ipython keyword parameter of cmd2.Cmd.__init__() to include_ipy.Kevin Van Brunt2021-03-3012-22/+17
| | | | | | | | | | Added include_py keyword parameter to cmd2.Cmd.__init__(). If False, then the py command will not be available. Removed ability to run Python commands from the command line with py. Made banners and exit messages of Python and IPython consistent. Changed utils.is_text_file() to raise OSError if file cannot be read.
* Fixed colors example codeKevin Van Brunt2021-03-231-4/+4
|
* No longer using -1 as an exit codeexit_codeKevin Van Brunt2021-03-232-2/+2
|
* Resolves comments from PREric Lin2021-03-189-12/+14
|
* Updated tab completion exampleKevin Van Brunt2021-03-021-3/+4
|
* Fixed black, isort, flake8, and doc8 issuesTodd Leonhardt2021-02-194-46/+61
|
* Merge branch 'master' into blackTodd Leonhardt2021-02-197-188/+187
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # 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
| * Merge branch 'master' into 2.0Kevin Van Brunt2021-01-2228-44/+168
| |\
| * \ Merge branch 'master' into 2.0Kevin Van Brunt2020-09-171-0/+80
| |\ \
| * \ \ Merge branch '2.0' into read_inputKevin Van Brunt2020-09-051-0/+1
| |\ \ \
| | * \ \ Merge branch 'master' into 2.0Kevin Van Brunt2020-09-051-0/+1
| | |\ \ \
| * | \ \ \ Merge branch '2.0' into read_inputKevin Van Brunt2020-09-033-6/+6
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge branch 'master' into 2.0Kevin Van Brunt2020-09-033-6/+6
| | |\ \ \ \
| * | | | | | Updated read_input exampleKevin Van Brunt2020-09-011-10/+33
| | | | | | |
| * | | | | | Added read_input() exampleKevin Van Brunt2020-09-011-0/+89
| |/ / / / /
| * | | | | Merge branch 'master' into 2.0Kevin Van Brunt2020-08-281-2/+2
| |\ \ \ \ \
| * \ \ \ \ \ Merge branch 'master' into 2.0Kevin Van Brunt2020-08-272-2/+2
| |\ \ \ \ \ \
| * \ \ \ \ \ \ Merge branch 'master' into 2.0Kevin Van Brunt2020-08-251-1/+1
| |\ \ \ \ \ \ \
| * | | | | | | | Updated async printing example to use thread event instead of a boolean flagKevin Van Brunt2020-08-181-7/+7
| | | | | | | | |
| * | | | | | | | Replaced choices_function / choices_method with choices_provider.Kevin Van Brunt2020-08-135-149/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | | | | Add in isort changesTodd Leonhardt2021-01-3117-24/+69
| | | | | | | | |
* | | | | | | | | Attempt to fix remaining black failuresTodd Leonhardt2021-01-312-6/+5
| | | | | | | | |
* | | | | | | | | Add black for automatic code formatTodd Leonhardt2021-01-3137-269/+253
| |_|_|_|_|_|_|/ |/| | | | | | |
* | | | | | | | Changed isort to force wrapping of imports to reduce merge conflicts from ↵Eric Lin2021-01-2228-48/+183
| |_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | minor import changes.
* | | | | | | Changes default category to be heritable by default - meaning that ↵Eric Lin2020-09-111-0/+80
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | subclasses will inherit the parent class's default category. Adds optional flag to disable heritability.
* | | | | | Added always_show_hint settingKevin Van Brunt2020-09-051-0/+1
| |_|_|_|/ |/| | | | | | | | | | | | | | Fixed issue where flag names weren't always sorted correctly in argparse tab completion
* | | | | Fixed type hints in example code1.3.9Kevin Van Brunt2020-09-031-1/+1
| | | | |
* | | | | Updated docsKevin Van Brunt2020-09-013-5/+5
| |_|_|/ |/| | |
* | | | Fixed issue where subcommand added with @as_subcommand_to decorator did not ↵Kevin Van Brunt2020-08-271-2/+2
| |_|/ |/| | | | | | | | | | | | | | display help when called with -h/--help. 'add_help=False' no longer has to be passed to parsers used in @as_subcommand_to decorator.
* | | The functions cmd2 adds to Namespaces (get_statement() and get_handler()) ↵Kevin Van Brunt2020-08-262-2/+2
| |/ |/| | | | | | | | | | | 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.
* | Fixed RecursionError when printing an argparse.Namespace caused by custom ↵Kevin Van Brunt2020-08-251-1/+1
|/ | | | | | attribute cmd2 was adding Added get_statement() function to argparse.Namespace which returns __statement__ attribute
* Breaking change: Removed cmd2 app as a required second parameter toEric Lin2020-08-126-51/+51
| | | | | | CommandSet command functions (do_, complete_, help_). Renamed install_command_set and uninstall_command_set to register_command_set and unregister_command_set.
* Minor housekeeping. Updated CODEOWNERS with recent additionsEric Lin2020-08-071-1/+1
|