summaryrefslogtreecommitdiff
path: root/examples/paged_output.py
Commit message (Collapse)AuthorAgeFilesLines
* Add in isort changesTodd Leonhardt2021-01-311-1/+3
|
* Add black for automatic code formatTodd Leonhardt2021-01-311-3/+2
|
* Changed isort to force wrapping of imports to reduce merge conflicts from ↵Eric Lin2021-01-221-1/+3
| | | | minor import changes.
* Replaced more pexcept uses with perrorKevin Van Brunt2019-06-251-5/+5
|
* Initial Commit for Issue 698xNinjaKittyx2019-06-241-3/+3
|
* Refactor exit_code implementationTodd Leonhardt2019-05-201-1/+2
| | | | | | | | | | | | 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
* Fix flake8 issuesTodd Leonhardt2018-12-061-1/+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
* Altered behavior further to lean towards giving the developer more power ↵Todd Leonhardt2018-06-161-12/+30
| | | | | | | | | | | | | over the end user Specifically: - PAGER environment variable is not used by default to set cmd2.Cmd.pager - This is done to ensure a consistent behavior of cmd2 applications across users by default Developers are free to set pager and pager_chop in the __init__() for their class derived from cmd2.Cmd differently to ensure whatever behavior they desire. Also: - Updated the paged_output.py example to demonstrate using ppaged() with both wrapped and chopped/truncated text
* Added pager settable parameter to control the command used to display paged ↵Todd Leonhardt2018-06-111-6/+15
| | | | | | | | | | | output Also: - ppaged() now uses the pager settable parameter - By default the pager settable parameter uses the PAGER environment variable if present - If PAGER environment variable is not present, pager gets set to: - "less -SXRF" on POSIX OSes (macOS and Linux) - "more" on Windows
* Standardize cmd2 imports in tests and exampleskotfu2018-05-231-3/+2
|
* Removed the expensive imports from cmd2/__init__.pyEric Lin2018-04-251-2/+2
| | | | | | | 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
* 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
* Addressed code review commentsKevin Van Brunt2018-03-271-2/+1
|
* Added an extra check to ppaged() to make sure cmd2 app is running in a real ↵Todd Leonhardt2018-03-201-0/+4
| | | | terminal before attempting to use a pager
* Added ppaged() method for printing output via a pagerTodd Leonhardt2018-03-071-0/+29
Also: - Added paged_output.py example - Modified cmd2 so it keeps track of when output is being redirected so it doesn't attempt to usage a pager in this case