diff options
author | Tom Rini <trini@konsulko.com> | 2021-09-24 20:35:50 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-09-24 20:35:50 -0400 |
commit | bf0491f8d8c2f259b6b7356744b9e6e05be8f6f2 (patch) | |
tree | decd8c20bc02d9039ce2ea6952e4642a71bc8190 /tools/patman/tools.py | |
parent | 7d1fcaea128ff689aea75deaf7f75d75d1b553d3 (diff) | |
parent | cc5afabc9d32933578536401114f91bbecff158b (diff) |
Merge branch '2021-09-24-assorted-updates' into next
- A few minor updates
Diffstat (limited to 'tools/patman/tools.py')
-rw-r--r-- | tools/patman/tools.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/patman/tools.py b/tools/patman/tools.py index 877e37cd8da..710f1fdcd36 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -5,6 +5,7 @@ import glob import os +import shlex import shutil import struct import sys @@ -581,3 +582,17 @@ 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 = shlex.split(os.getenv('PAGER', '')) + if not pager: + lesspath = shutil.which('less') + pager = [lesspath] if lesspath else None + if not pager: + pager = ['more'] + command.Run(*pager, fname) |