1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-27 13:31:16 +02:00

tools: Refactor full help printing

Collect the code for printing the full help message of patman, buildman
and binman into a single function in patman.tools.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
This commit is contained in:
Paul Barker
2021-09-08 12:38:01 +01:00
committed by Tom Rini
parent 15e30106ce
commit 5fe50f9a40
4 changed files with 24 additions and 20 deletions

View File

@@ -581,3 +581,16 @@ def ToHexSize(val):
hex value of size, or 'None' if the value is None
"""
return 'None' if val is None else '%#x' % len(val)
def PrintFullHelp(fname):
"""Print the full help message for a tool using an appropriate pager.
Args:
fname: Path to a file containing the full help message
"""
pager = os.getenv('PAGER')
if not pager:
pager = shutil.which('less')
if not pager:
pager = 'more'
command.Run(pager, fname)