summaryrefslogtreecommitdiffstats
path: root/scripts/wic
diff options
context:
space:
mode:
authorChee Yang Lee <chee.yang.lee@intel.com>2019-11-08 11:41:19 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-14 12:55:56 +0000
commitd29d553cc096f4e1208c44dc595e1cf365c3dff3 (patch)
tree01e62f48987c1a62882624f6e54ecfa6775925ac /scripts/wic
parente3f8b1dd5fa1bb85b685148b5ba106c61367294d (diff)
downloadopenembedded-core-contrib-d29d553cc096f4e1208c44dc595e1cf365c3dff3.tar.gz
openembedded-core-contrib-d29d553cc096f4e1208c44dc595e1cf365c3dff3.tar.bz2
openembedded-core-contrib-d29d553cc096f4e1208c44dc595e1cf365c3dff3.zip
wic: beautify 'wic help'
The Wic help returned to the user is unreadable. Use a custom ArgumentParser to override argparse help message. change help message as suggest in https://bugzilla.yoctoproject.org/show_bug.cgi?id=12205 [YOCTO #12205] changes applies to 'wic help', 'wic -h', 'wic --h' and 'wic --help' Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/wic')
-rwxr-xr-xscripts/wic8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/wic b/scripts/wic
index 1d89fb2eda..1a717300f5 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -495,14 +495,18 @@ def init_parser(parser):
subparser = subparsers.add_parser(subcmd, help=subcommands[subcmd][2])
subcommands[subcmd][3](subparser)
+class WicArgumentParser(argparse.ArgumentParser):
+ def format_help(self):
+ return hlp.wic_help
def main(argv):
- parser = argparse.ArgumentParser(
+ parser = WicArgumentParser(
description="wic version %s" % __version__)
init_parser(parser)
args = parser.parse_args(argv)
+
if args.debug:
logger.setLevel(logging.DEBUG)
@@ -510,8 +514,6 @@ def main(argv):
if args.command == "help":
if args.help_topic is None:
parser.print_help()
- print()
- print("Please specify a help topic")
elif args.help_topic in helptopics:
hlpt = helptopics[args.help_topic]
hlpt[0](hlpt[1], hlpt[2])