mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
tools: Handle PAGER containing arguments
When printing full help output from a tool, we should be able to handle a PAGER variable which includes arguments, e.g. PAGER='less -F'. Signed-off-by: Paul Barker <paul.barker@sancloud.com>
This commit is contained in:
parent
5fe50f9a40
commit
0d60e5d8e9
1 changed files with 6 additions and 4 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
import glob
|
||||
import os
|
||||
import shlex
|
||||
import shutil
|
||||
import struct
|
||||
import sys
|
||||
|
@ -588,9 +589,10 @@ def PrintFullHelp(fname):
|
|||
Args:
|
||||
fname: Path to a file containing the full help message
|
||||
"""
|
||||
pager = os.getenv('PAGER')
|
||||
pager = shlex.split(os.getenv('PAGER', ''))
|
||||
if not pager:
|
||||
pager = shutil.which('less')
|
||||
lesspath = shutil.which('less')
|
||||
pager = [lesspath] if lesspath else None
|
||||
if not pager:
|
||||
pager = 'more'
|
||||
command.Run(pager, fname)
|
||||
pager = ['more']
|
||||
command.Run(*pager, fname)
|
||||
|
|
Loading…
Reference in a new issue