forked from Imagelibrary/littlefs
scripts: Changed -o/-O to an exclusive operation
So: $ ./scripts/code.py lfs.o -o- -q Becomes: $ ./scripts/code.py lfs.o -o- The original intention of -o/-O _not_ being exclusive (aka table is still rendered unless disabled with -q/--quiet), was to allow results to be written to csv files and rendered to tables in a single pass. But this was never useful. Heck, we're not even using this in our Makefile right now because it would make the rule dependencies more complicated than it's worth. Even for long-running result scripts (perf.py, perfbd.py, etc), most of the work is building that csv file, the cost of rendering a table in a second pass is negligible. In every case I've used -o/-O, I've also wanted -q/--quiet, and almost always forget this on the first run. So might as well make the expected behavior the actual behavior. --- As a plus, this let us simplify some of the scripts a bit, by replacing visibility filters with -o/-O dependent by-fields.
This commit is contained in:
@@ -1053,20 +1053,6 @@ def main(ci_paths,
|
||||
depth=depth,
|
||||
hot=hot)
|
||||
|
||||
# write results to CSV/JSON
|
||||
if args.get('output'):
|
||||
write_csv(args['output'], StackResult, results,
|
||||
by=by,
|
||||
fields=fields,
|
||||
depth=depth,
|
||||
**args)
|
||||
if args.get('output_json'):
|
||||
write_csv(args['output_json'], StackResult, results, json=True,
|
||||
by=by,
|
||||
fields=fields,
|
||||
depth=depth,
|
||||
**args)
|
||||
|
||||
# find previous results?
|
||||
diff_results = None
|
||||
if args.get('diff') or args.get('percent'):
|
||||
@@ -1091,8 +1077,22 @@ def main(ci_paths,
|
||||
depth=depth,
|
||||
hot=hot)
|
||||
|
||||
# write results to JSON
|
||||
if args.get('output_json'):
|
||||
write_csv(args['output_json'], StackResult, results, json=True,
|
||||
by=by,
|
||||
fields=fields,
|
||||
depth=depth,
|
||||
**args)
|
||||
# write results to CSV
|
||||
elif args.get('output'):
|
||||
write_csv(args['output'], StackResult, results,
|
||||
by=by,
|
||||
fields=fields,
|
||||
depth=depth,
|
||||
**args)
|
||||
# print table
|
||||
if not args.get('quiet'):
|
||||
else:
|
||||
table(StackResult, results, diff_results,
|
||||
by=by,
|
||||
fields=fields,
|
||||
@@ -1121,10 +1121,6 @@ if __name__ == "__main__":
|
||||
'-v', '--verbose',
|
||||
action='store_true',
|
||||
help="Output commands that run behind the scenes.")
|
||||
parser.add_argument(
|
||||
'-q', '--quiet',
|
||||
action='store_true',
|
||||
help="Don't show anything, useful with -o.")
|
||||
parser.add_argument(
|
||||
'-o', '--output',
|
||||
help="Specify CSV file to store results.")
|
||||
|
||||
Reference in New Issue
Block a user