Skip to content
Snippets Groups Projects
Commit 4e7c882c authored by Zane Bitter's avatar Zane Bitter
Browse files

Automatically page interactive root help output

The previous commit already ensures that the interactive help for
individual commands is sent to a pager. This does the same for the
'help' command with no arguments.

Change-Id: If5e38421d21e09f88a572dbb508b1997381bdb87
parent 8fa916e9
No related branches found
Tags 3.10.1
No related merge requests found
......@@ -17,6 +17,7 @@ import itertools
import shlex
import sys
import autopage.argparse
import cmd2
......@@ -140,9 +141,16 @@ class InteractiveApp(cmd2.Cmd):
parsed = lambda x: x # noqa
self.default(parsed('help ' + arg))
else:
cmd2.Cmd.do_help(self, arg)
cmd_names = sorted([n for n, v in self.command_manager])
self.print_topics(self.app_cmd_header, cmd_names, 15, 80)
stdout = self.stdout
try:
with autopage.argparse.help_pager(stdout) as paged_out:
self.stdout = paged_out
cmd2.Cmd.do_help(self, arg)
cmd_names = sorted([n for n, v in self.command_manager])
self.print_topics(self.app_cmd_header, cmd_names, 15, 80)
finally:
self.stdout = stdout
return
# Create exit alias to quit the interactive shell.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment