summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
...
* Added labels for each command help textKevin Van Brunt2018-12-201-2/+13
|
* Fixing flake8 warningKevin Van Brunt2018-12-201-0/+1
|
* Added new example script that saves help text to a fileKevin Van Brunt2018-12-201-0/+67
|
* Fix flake8 issuesTodd Leonhardt2018-12-0614-69/+63
| | | | | | | | | | | | | | | | | | | | | | 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
|
* Undefined names: from colorama import Fore, Backcclauss2018-11-181-0/+1
| | | | | | | | | | | | | | | __Fore__ and __Back__ are used on line 128 but they are never defined or imported. That means that they are _undefined names_ which have the potential to raise NameError at runtime. [flake8](http://flake8.pycqa.org) testing of https://github.com/python-cmd2/cmd2 on Python 3.7.1 $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./examples/plumbum_colors.py:127:21: F821 undefined name 'Fore' color_off = Fore.RESET + Back.RESET ^ ./examples/plumbum_colors.py:127:34: F821 undefined name 'Back' color_off = Fore.RESET + Back.RESET ^ ```
* Update docs with smart ANSI handling for ppagedEthan McCreadie2018-11-012-16/+18
|
* Refactored filtering in path_complete to use a functionKevin Van Brunt2018-10-261-1/+1
|
* Added code to handle -- in argparse completerKevin Van Brunt2018-10-101-1/+1
|
* Added warning to documentation about how help_foo won't be called for ↵Todd Leonhardt2018-10-062-6/+5
| | | | | | | command foo if it uses an argparse decorator Also: - Renamed argparse_example.py to decorator_example.py
* Added documentation stating that parsers passed to argparse decorators need ↵Todd Leonhardt2018-10-061-9/+17
| | | | | | | to be unique Also: - Modified table_display.py to demonstrate a workaround
* Moved main.py to exampels/hello_cmd2.py and added some commentsTodd Leonhardt2018-10-061-0/+16
|
* Merge remote-tracking branch 'origin/master' into argparse_remainderEric Lin2018-10-064-28/+28
|\
| * Using sub-command instead of subcommand where possible to be consistent with ↵Kevin Van Brunt2018-10-054-28/+28
| | | | | | | | argparse
* | Fixed a few edge cases:Eric Lin2018-10-061-0/+2
| | | | | | | | | | | | | | | | | | - Once the argument list can match a positional and that positional is tagged with nargs=argparse.REMAINDER it will consume all tokens including flag tokens. AutoCompleter now correctly detects this case will no longer attempt to complete flag tokens - A single-character token that is a flag prefix doesn't count as a flag and is parsed as a value. AutoCompleter now correctly detects this case.
* | Added handling of nargs=argparse.REMAINDER in both AutoCompleter and ↵Eric Lin2018-10-061-1/+1
|/ | | | | | | | ArgparseFunctor Should correctly force all subsequent arguments to go to the REMAINDER argument once it is detected. Re-arranged the command generation in ArgparseFunctor to print flag arguments before positionals Also forces the remainder arguments to always be last.
* Made hooks.py executableTodd Leonhardt2018-09-281-0/+0
|
* Updated abbreviation example to use new cmd2 function to resolve command ↵Kevin Van Brunt2018-09-281-5/+5
| | | | functions
* Addressing code review commentsKevin Van Brunt2018-09-281-1/+1
|
* Updated a couple files in the examples directory due to changes in alias commandTodd Leonhardt2018-09-272-6/+5
|
* Merged alert_printer stuff from master and resolved conflictsTodd Leonhardt2018-09-251-0/+203
|\
| * Merge branch 'master' into alert_printerKevin Van Brunt2018-09-251-0/+38
| |\
| * | Added more examples and documentationKevin Van Brunt2018-09-251-2/+8
| | |
| * | Merge branch 'master' into alert_printerTodd Leonhardt2018-09-251-1/+1
| |\ \
| * | | Made async stuff publicKevin Van Brunt2018-09-251-8/+8
| | | |
| * | | Made demo more instructiveKevin Van Brunt2018-09-231-92/+103
| | | |
| * | | Added more alerts and updated documentationKevin Van Brunt2018-09-221-12/+39
| | | |
| * | | Recreating the thread in preloop to support multiple calls of cmdloopKevin Van Brunt2018-09-221-1/+3
| | | |
| * | | Updating prompt in example appKevin Van Brunt2018-09-211-7/+43
| | | |
| * | | First version of async printing exampleKevin Van Brunt2018-09-211-0/+121
| | | |
* | | | Merge branch 'master' into colorizeTodd Leonhardt2018-09-251-0/+38
|\ \ \ \ | | |_|/ | |/| |
| * | | Merge branch 'master' into command_help_noflagKevin Van Brunt2018-09-251-1/+1
| |\ \ \ | | | |/ | | |/|
| * | | Added the the ability to format help to the AutoCompleter to support ↵Eric Lin2018-09-231-0/+38
| | |/ | |/| | | | | | | sub-command specific help lookup.
* | | Merge branch 'master' into colorizeTodd Leonhardt2018-09-251-1/+1
|\ \ \ | | |/ | |/|
| * | Removed a Python3-only comment from an example since Python 2 is no longer ↵Todd Leonhardt2018-09-251-1/+1
| |/ | | | | | | supported
* | Added optional color argument to poutput() for providing a color escape code ↵Todd Leonhardt2018-09-242-4/+20
| | | | | | | | | | | | | | | | 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
* | Added plumbum_colors.py example of using plumbum.colorsTodd Leonhardt2018-09-231-0/+144
| |
* | Merge branch 'master' into colorizeTodd Leonhardt2018-09-212-6/+6
|\ \ | |/
| * Removed remaining type hints in docstringsKevin Van Brunt2018-09-212-6/+6
| |
* | Updated a couple example transcripts now that colors is no longer True/FalseTodd Leonhardt2018-09-213-6/+4
| | | | | | | | | | Also: - Minor whitespace tweaks to new colors.py example
* | cmd2.Cmd.__init__ now initializes colorama and tells it to never strip ANSI ↵Todd Leonhardt2018-09-191-5/+6
| | | | | | | | | | | | | | | | codes since cmd2 deals with that Also: - Finished editing poutput(), ppaged(), and pfeedback() methods to strip ANSI color when appropriate - Changed attr.ib() factory usage so cmd2 is compatible with older versions of attrs
* | Merge branch 'master' into colorizeTodd Leonhardt2018-09-193-2/+6
|\ \ | |/
| * Added a command which does nothing and produces no output to ↵Todd Leonhardt2018-09-141-0/+4
| | | | | | | | | | | | alias_startup.py example This is just for some manual edge cases testing.
| * Fixed a couple example transcripts which were never updated when the default ↵Todd Leonhardt2018-09-142-2/+2
| | | | | | | | for locals_in_py changed to False
* | Merged master in and resolved conflictsTodd Leonhardt2018-09-043-7/+287
|\ \ | |/ | | | | @kotfu - I hope this doesn't screw you up, but I wanted to minimize some of the merge pain that will likely be coming up soon
| * Merge branch 'master' into ac_parserTodd Leonhardt2018-08-241-0/+43
| |\
| | * Added a couple unit tests of the exit code featureTodd Leonhardt2018-08-231-4/+2
| | |
| | * Added way of returning a non-zero exit code to the shellTodd Leonhardt2018-08-231-0/+45
| | |
| * | ACHelpFormatter now inherits from argparse.RawTextHelpFormatter to make it ↵Kevin Van Brunt2018-08-241-7/+4
| |/ | | | | | | easier to format help/description text
| * Copied and reduced the tab_autocompletion example to specifically exercise ↵Eric Lin2018-08-191-0/+240
| | | | | | | | | | | | updating the argparse object during init instead of durng the class construction.