summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/paged_output.py4
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)