They should still be positional arguments. For example, the output of --help (after the 5th patch) is:
> usage: nv-report.py [-h] [--top ATTR N] [--smallest ATTR N] before after > > Shows changes between two shader-db runs for the nouveau drivers. > > positional arguments: > before the baseline run > after the run to compare against the baseline > > optional arguments: > -h, --help show this help message and exit > --top ATTR N also show the top n programs affected for attr > --smallest ATTR N also show the smallest n programs affected for attr (it doesn't seem to matter where --top/--smallest is) On Fri, Aug 3, 2018 at 10:29 PM, Ilia Mirkin <imir...@alum.mit.edu> wrote: > I'd rather keep these as positional args. You can still use argparse > for other optional items. > > On Fri, Aug 3, 2018 at 3:53 PM, Rhys Perry <pendingchao...@gmail.com> wrote: >> Signed-off-by: Rhys Perry <pendingchao...@gmail.com> >> --- >> nv-report.py | 13 +++++++++++-- >> 1 file changed, 11 insertions(+), 2 deletions(-) >> >> diff --git a/nv-report.py b/nv-report.py >> index 079b2e08a3..1c1491af0a 100644 >> --- a/nv-report.py >> +++ b/nv-report.py >> @@ -12,11 +12,15 @@ fields, except for the type, are optional. >> >> import re >> import sys >> +import argparse >> >> >> STATS = ["local", "shared", "gpr", "inst", "bytes"] >> ATTRS = ["name", "type"] + STATS >> >> +DESCRIPTION = """Shows changes between two shader-db runs for the nouveau >> +drivers.""" >> + >> def getgroupvalue(m, groupname): >> if not m[groupname]: >> return 0 >> @@ -130,8 +134,13 @@ def print_helped_hurt(keys, before, after): >> print >> >> def main(argv): >> - before = read_stats(argv[1]) >> - after = read_stats(argv[2]) >> + parser = argparse.ArgumentParser(description=DESCRIPTION) >> + parser.add_argument('before', help="the baseline run") >> + parser.add_argument('after', help="the run to compare against the >> baseline") >> + args = parser.parse_args(argv[1:]) >> + >> + before = read_stats(args.before) >> + after = read_stats(args.after) >> >> keys = set() >> for key in set(before.stats.keys()) | set(after.stats.keys()): >> -- >> 2.14.4 >> >> _______________________________________________ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev