Browse Source

add global --pager option

The MMGen Project 2 years ago
parent
commit
61857101fd
2 changed files with 4 additions and 0 deletions
  1. 1 0
      mmgen/opts.py
  2. 3 0
      mmgen/util.py

+ 1 - 0
mmgen/opts.py

@@ -240,6 +240,7 @@ common_opts_data = {
 --, --color=0|1            Disable or enable color output (enabled by default)
 --, --columns=N            Force N columns of output with certain commands
 --, --force-256-color      Force 256-color output when color is enabled
+--, --pager                Pipe output of certain commands to pager (WIP)
 --, --data-dir=path        Specify {pnm} data directory location
 --, --daemon-data-dir=path Specify coin daemon data directory location
 --, --daemon-id=ID         Specify the coin daemon ID

+ 3 - 0
mmgen/util.py

@@ -601,6 +601,9 @@ def keypress_confirm(prompt,default_yes=False,verbose=False,no_nl=False,complete
 		else:
 			msg_r('\nInvalid reply\n' if verbose else '\r')
 
+def stdout_or_pager(s):
+	(do_pager if opt.pager else Msg_r)(s)
+
 def do_pager(text):
 
 	pagers = ['less','more']