From b0f4a66e2cbf73175e57a02c46407e752e3579e7 Mon Sep 17 00:00:00 2001 From: Scott Piper Date: Mon, 8 Nov 2021 09:24:41 -0700 Subject: [PATCH] Add output-file arg --- commands/report.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/commands/report.py b/commands/report.py index eb27362aa..1cbd29d7b 100644 --- a/commands/report.py +++ b/commands/report.py @@ -67,7 +67,7 @@ def report(accounts, config, args): # Create directory for output file if it doesn't already exists try: - os.mkdir(os.path.dirname(REPORT_OUTPUT_FILE)) + os.mkdir(os.path.dirname(args.output_file)) except OSError: # Already exists pass @@ -439,10 +439,10 @@ def report(accounts, config, args): t["findings"][conf["group"]] = group # Generate report from template - with open(REPORT_OUTPUT_FILE, "w") as f: + with open(args.output_file, "w") as f: f.write(template.render(t=t)) - print("Report written to {}".format(REPORT_OUTPUT_FILE)) + print("Report written to {}".format(args.output_file)) def run(arguments): @@ -453,6 +453,11 @@ def run(arguments): default=90, type=int, ) + parser.add_argument( + "--output-file", + help="Path to write report output to", + default=REPORT_OUTPUT_FILE, + ) parser.add_argument( "--stats_all_resources", help="Show stats for all resource types",