summaryrefslogtreecommitdiff
path: root/examples/decorator_example.py
Commit message (Collapse)AuthorAgeFilesLines
* Updated all examples to use Cmd2ArgumentParser instead of ↵Kevin Van Brunt2021-06-171-3/+3
| | | | | | 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-271-1/+1
|
* Renamed use_ipython keyword parameter of cmd2.Cmd.__init__() to include_ipy.Kevin Van Brunt2021-03-301-4/+1
| | | | | | | | | | 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.
* Resolves comments from PREric Lin2021-03-181-1/+1
|
* Add in isort changesTodd Leonhardt2021-01-311-1/+3
|
* Add black for automatic code formatTodd Leonhardt2021-01-311-5/+5
|
* Changed isort to force wrapping of imports to reduce merge conflicts from ↵Eric Lin2021-01-221-1/+3
| | | | minor import changes.
* The functions cmd2 adds to Namespaces (get_statement() and get_handler()) ↵Kevin Van Brunt2020-08-261-1/+1
| | | | | | | 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
* Added cmd2.utils.Settable to the cmd2 namespace and updated examples and docsTodd Leonhardt2020-02-041-1/+1
|
* Fixed a bunch of examples which were broken due to moving DEFAULT_SHORTCUTS ↵Todd Leonhardt2019-06-161-1/+1
| | | | from cmd2.py to constants.py
* Removed support for cmd.cmdqueueKevin Van Brunt2019-06-111-3/+0
| | | | allow_cli_args is now an argument to __init__ instead of a cmd2 class member
* Refactor exit_code implementationTodd Leonhardt2019-05-201-2/+3
| | | | | | | | | | | | cmd2.Cmd.cmdloop() now returns self.exit_code which should be an integer Also: - Refactored examples to call sys.exit(app.cmdloop()) in their __main__ - Running transcript tests now sets the exit_code accordingly based on success/failure - Updated CHANGELOG - Updated README - Updated Sphinx docs - Added unit test for case when transcript test fails
* Merge branch 'master' into attributesTodd Leonhardt2019-03-171-5/+11
|\
| * Updated docs and exampleKevin Van Brunt2019-03-171-5/+11
| |
* | Fixed how shortcuts are set in examplesTodd Leonhardt2019-03-141-4/+5
| |
* | First stage of attribute refactoringTodd Leonhardt2019-03-131-2/+1
|/ | | | | | | | | | The following are now arguments to cmd2.Cmd.__init__() instead of class attributes: * allow_redirection * multiline_commands * terminators * shortcuts Added a couple read-only properties for convenience of cmd2.Cmd accessing immutable members from self.statement_parser
* Changed examples to reflect that settable doesn't need to be updated before ↵Kevin Van Brunt2019-02-201-3/+3
| | | | calling init()
* Fix flake8 issuesTodd Leonhardt2018-12-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | 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
* Added warning to documentation about how help_foo won't be called for ↵Todd Leonhardt2018-10-061-0/+112
command foo if it uses an argparse decorator Also: - Renamed argparse_example.py to decorator_example.py