aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2017-12-01 15:04:44 +0000
committersetrofim <setrofim@gmail.com>2017-12-06 17:05:52 +0000
commitb85098d5b21783a70f7adf45083b24aea875589b (patch)
treee5c2fcab347f3dea7630b0a1c7cd4f0defc5270c
parentbfb9dd2c43678057b39d6038d3337ddbec4efef7 (diff)
framework/entrypoint: Fix help information for subcommands
Previously only the top level help message would ever be displayed, this was caused by 'parse_known_commands' automatically displaying the default help message and exiting before any of the custom plugins are loaded. Now ensure this flag is never passed into the method.
-rw-r--r--wa/framework/entrypoint.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/wa/framework/entrypoint.py b/wa/framework/entrypoint.py
index 6c025c88..b72fddcc 100644
--- a/wa/framework/entrypoint.py
+++ b/wa/framework/entrypoint.py
@@ -81,7 +81,15 @@ def main():
# full argument parse cannot be complted until the commands are loaded; so
# parse just the base args for know so we can get verbosity.
argv = split_joined_options(sys.argv[1:])
- args, _ = parser.parse_known_args(argv)
+
+ # 'Parse_known_args' automatically displays the default help and exits
+ # if '-h' is detected, we want our custom help messages so ensure this
+ # is never passed as a parameter.
+ filtered_argv = list(argv)
+ if '-h' in filtered_argv:
+ filtered_argv.remove('-h')
+
+ args, _ = parser.parse_known_args(filtered_argv)
settings.set("verbosity", args.verbose)
log.init(settings.verbosity)