diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-03-20 16:25:08 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-03-20 16:25:08 -0400 |
commit | 0faf8959dbc4bd2175683939305e1926590d36ed (patch) | |
tree | 90caec077aaf22000e9b59d6ff890a87de6b8068 /examples/paged_output.py | |
parent | 328b408fa755a17268c33f0fae0301bb85d1f102 (diff) | |
download | cmd2-git-0faf8959dbc4bd2175683939305e1926590d36ed.tar.gz |
Added an extra check to ppaged() to make sure cmd2 app is running in a real terminal before attempting to use a pager
Diffstat (limited to 'examples/paged_output.py')
-rwxr-xr-x | examples/paged_output.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/paged_output.py b/examples/paged_output.py index 171c1b3e..9005a4da 100755 --- a/examples/paged_output.py +++ b/examples/paged_output.py @@ -17,6 +17,10 @@ class PagedOutput(cmd2.Cmd): @with_argument_list def do_page_file(self, args): """Read in a text file and display its output in a pager.""" + if not args: + self.perror('page_file requires a path to a file as an argument', traceback_war=False) + return + with open(args[0], 'r') as f: text = f.read() self.ppaged(text) |