diff options
| author | Chee Yang Lee <chee.yang.lee@intel.com> | 2019-11-08 11:41:19 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-14 13:20:59 +0000 |
| commit | 621b10f0075bc5d499a2151661c6e1a414f12953 (patch) | |
| tree | 48e42f143e81d824112a77e42ae99d9b016b8ed4 /scripts/wic | |
| parent | 70573f66ecf7b591f2d1329dcd4267c9d71ca6ce (diff) | |
| download | poky-621b10f0075bc5d499a2151661c6e1a414f12953.tar.gz | |
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'
(From OE-Core rev: d29d553cc096f4e1208c44dc595e1cf365c3dff3)
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-x | scripts/wic | 8 |
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): | |||
| 495 | subparser = subparsers.add_parser(subcmd, help=subcommands[subcmd][2]) | 495 | subparser = subparsers.add_parser(subcmd, help=subcommands[subcmd][2]) |
| 496 | subcommands[subcmd][3](subparser) | 496 | subcommands[subcmd][3](subparser) |
| 497 | 497 | ||
| 498 | class WicArgumentParser(argparse.ArgumentParser): | ||
| 499 | def format_help(self): | ||
| 500 | return hlp.wic_help | ||
| 498 | 501 | ||
| 499 | def main(argv): | 502 | def main(argv): |
| 500 | parser = argparse.ArgumentParser( | 503 | parser = WicArgumentParser( |
| 501 | description="wic version %s" % __version__) | 504 | description="wic version %s" % __version__) |
| 502 | 505 | ||
| 503 | init_parser(parser) | 506 | init_parser(parser) |
| 504 | 507 | ||
| 505 | args = parser.parse_args(argv) | 508 | args = parser.parse_args(argv) |
| 509 | |||
| 506 | if args.debug: | 510 | if args.debug: |
| 507 | logger.setLevel(logging.DEBUG) | 511 | logger.setLevel(logging.DEBUG) |
| 508 | 512 | ||
| @@ -510,8 +514,6 @@ def main(argv): | |||
| 510 | if args.command == "help": | 514 | if args.command == "help": |
| 511 | if args.help_topic is None: | 515 | if args.help_topic is None: |
| 512 | parser.print_help() | 516 | parser.print_help() |
| 513 | print() | ||
| 514 | print("Please specify a help topic") | ||
| 515 | elif args.help_topic in helptopics: | 517 | elif args.help_topic in helptopics: |
| 516 | hlpt = helptopics[args.help_topic] | 518 | hlpt = helptopics[args.help_topic] |
| 517 | hlpt[0](hlpt[1], hlpt[2]) | 519 | hlpt[0](hlpt[1], hlpt[2]) |
