summaryrefslogtreecommitdiff
path: root/examples/pirate.py
Commit message (Collapse)AuthorAgeFilesLines
* No longer using -1 as an exit codeexit_codeKevin Van Brunt2021-03-231-1/+1
|
* 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-3/+3
|
* Changed isort to force wrapping of imports to reduce merge conflicts from ↵Eric Lin2021-01-221-1/+3
| | | | minor import changes.
* Having two parallel datastructures each for foreground and background colors ↵Todd Leonhardt2020-02-061-1/+1
| | | | | | felt really clunky - now we just have one The Enum classes are now smart and deal with it all.
* Added cmd2.utils.Settable to the cmd2 namespace and updated examples and docsTodd Leonhardt2020-02-041-1/+1
|
* Changed signature of style() to allow for simpler calling and overriding of ↵Kevin Van Brunt2019-06-261-1/+1
| | | | settings in a provided TextStyle
* Added TextStyle class and default implementations for various message types ↵Kevin Van Brunt2019-06-261-1/+2
| | | | like Warning, Error, and Succes
* Moved code related to ANSI escape codes to new file called ansi.pyKevin Van Brunt2019-06-261-2/+1
|
* Renamed style_message to styleKevin Van Brunt2019-06-261-1/+1
|
* Removed color args from poutput since the style function is going to do more ↵Kevin Van Brunt2019-06-251-14/+2
| | | | than color
* Initial Commit for Issue 698xNinjaKittyx2019-06-241-4/+3
|
* 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
* Refactor exit_code implementationTodd Leonhardt2019-05-201-1/+5
| | | | | | | | | | | | 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
* Fixed how shortcuts are set in examplesTodd Leonhardt2019-03-141-6/+5
|
* First stage of attribute refactoringTodd Leonhardt2019-03-131-3/+2
| | | | | | | | | | 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-2/+5
| | | | calling init()
* Fix flake8 issuesTodd Leonhardt2018-12-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* Fixed bug in example caused by a keyword argument being used with dict.get()Kevin Van Brunt2018-11-301-1/+1
|
* Added optional color argument to poutput() for providing a color escape code ↵Todd Leonhardt2018-09-241-3/+17
| | | | | | | | to colorize the output with Also: - Added optional err_color and war_color arguments to perror() for providing color escape codes - Removed usage of deprecated colorize() method within the examples
* Fix import stragglerskotfu2018-05-231-2/+2
|
* Standardize cmd2 imports in tests and exampleskotfu2018-05-231-3/+4
|
* Merge branch 'test_merge' into test_ply_mergeEric Lin2018-05-021-1/+1
|\
| * Removed the expensive imports from cmd2/__init__.pyEric Lin2018-04-251-1/+1
| | | | | | | | | | | | | | 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
* | multilineCommands -> multiline_commandskotfu2018-04-291-1/+1
|/
* Started removing dependency on sixTodd Leonhardt2018-04-151-1/+1
| | | | | | | Removed all dependency on six other than for six.moves.input Also: - Started removing code branches which were for Python 2 support
* Updated one example so it can be used properly with default_to_shellTodd Leonhardt2018-03-161-4/+0
|
* Renamed @with_argument_parser decorator to @with_argparserTodd Leonhardt2018-01-211-2/+2
| | | | | Also: - Reanamed foo and bar subcommand methods to base_foo and base_bar
* History enhancementsTodd Leonhardt2018-01-201-8/+8
| | | | | | | | | | History changes: - Unknown commands are no longer saved in the history - history command now has a -t option to generate a transcript based on commands in the history Also: - Moved examples transcripts from examples to examples/transcripts - Added a new transcript for use with the pirate.py example
* Simplified a few argparse examples and fixed some incorrect documentationTodd Leonhardt2018-01-171-2/+2
| | | | | | I eliminated a few "narg=1" configurations so that a single str value is returned instead of a List[str]. I also reworded some documentation which was no longer correct after the last commit which made "history command" have the same help text as "command -h" when using one of the two argparse decorators.
* Changed @with_argument_parser to only pass single argument to commandsTodd Leonhardt2018-01-151-11/+12
| | | | Also added another @with_argparser_and_list decorator that uses argparse.parse_known_args to pass two arguments to a command: both the argparse output and a list of unknown/unmatched args.
* Modified examples still using @options to import make_option from optparseTodd Leonhardt2018-01-151-1/+2
|
* Fixed a few bugs and examplesTodd Leonhardt2017-07-031-7/+9
| | | | | | | | | | | | | | Bug fixes: - case_insensitive is no longer a runtime-settable parameter, but it was still listed as such - Fixed a recursive loop bug when abbreviated commands are enabled and it could get stuck in the editor forever - Added additional command abbreviations to the "exclude from history" list - Fixed argparse_example.py and pirate.py examples Other changes: - Organized all attributes used to configure the ParserManager into a single location - Set the default value of "abbrev" to False (which controls whether or not abbreviated commands are allowed) - With good tab-completion of command names, using abbreviated commands isn't a particularly useful feature - And it can create problems
* Mostly fix a bunch of spelling mistakes.Todd Leonhardt2017-03-131-1/+1
| | | | A few other miscellaneous minor tweaks for whitespace and such.
* Improved examplesTodd Leonhardt2017-03-111-0/+89
Added the pirate8.py example from Catherine's PyCon2010 talk as pirate.py with some cleanups done. Added an example of a complete_* method for command argument completion to the python_scripting.py example.