[PATCH] D34081: [opt-viewer] Include default values in help output
Brian Gesiak via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 10 08:06:02 PDT 2017
modocache created this revision.
Herald added a subscriber: fhahn.
Python's argparse module includes a `%(default)s` format specifier that
can be used to print the default value of an option in its help text.
Use this for opt-viewer utilities' `--jobs` arguments.
https://reviews.llvm.org/D34081
Files:
utils/opt-viewer/opt-diff.py
utils/opt-viewer/opt-stats.py
utils/opt-viewer/opt-viewer.py
Index: utils/opt-viewer/opt-viewer.py
===================================================================
--- utils/opt-viewer/opt-viewer.py
+++ utils/opt-viewer/opt-viewer.py
@@ -208,7 +208,7 @@
'-j',
default=cpu_count(),
type=int,
- help='Max job count (defaults to current CPU count)')
+ help='Max job count (defaults to %(default)s, the current CPU count)')
parser.add_argument(
'-source-dir',
'-s',
Index: utils/opt-viewer/opt-stats.py
===================================================================
--- utils/opt-viewer/opt-stats.py
+++ utils/opt-viewer/opt-stats.py
@@ -21,7 +21,7 @@
'-j',
default=cpu_count(),
type=int,
- help='Max job count (defaults to current CPU count)')
+ help='Max job count (defaults to %(default)s, the current CPU count)')
args = parser.parse_args()
if len(args.yaml_files) == 0:
Index: utils/opt-viewer/opt-diff.py
===================================================================
--- utils/opt-viewer/opt-diff.py
+++ utils/opt-viewer/opt-diff.py
@@ -43,7 +43,7 @@
'-j',
default=cpu_count(),
type=int,
- help='Max job count (defaults to current CPU count)')
+ help='Max job count (defaults to %(default)s, the current CPU count)')
parser.add_argument('--output', '-o', default='diff.opt.yaml')
args = parser.parse_args()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34081.102116.patch
Type: text/x-patch
Size: 1432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170610/3d55903d/attachment.bin>
More information about the llvm-commits
mailing list