Commit 78c81ba3 authored by Emmanuele Bassi's avatar Emmanuele Bassi 👣
Browse files

main: Add main CLI options

We want the "quiet" and "fatal warnings" options to live on the main
parser, instead of sub-commands, so we can initialise the logging system
once, and print out the report at the end.
parent c205956a
......@@ -21,6 +21,8 @@ class GIDocGenApp:
self.quiet = False
self.commands = {}
self.parser = argparse.ArgumentParser(prog='gi-docgen', formatter_class=self.formatter)
self.parser.add_argument("-q", "--quiet", action="store_true", help="suppress messages except warnings")
self.parser.add_argument("--fatal-warnings", action="store_true", help="whether warnings are fatal")
self.subparser = self.parser.add_subparsers(title='Commands',
description='If no command is specified, default to help')
......@@ -44,8 +46,17 @@ class GIDocGenApp:
options = self.parser.parse_args(args)
return options.run_func(options)
res = options.run_func(options)
report_res =
if res == 0:
return report_res
return res
except Exception:
return 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment