diff options
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/wic/engine.py | 11 | ||||
| -rw-r--r-- | scripts/lib/wic/help.py | 23 |
2 files changed, 22 insertions, 12 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index f59821fea6..647358287f 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
| @@ -201,17 +201,18 @@ def wic_list(args, scripts_path): | |||
| 201 | """ | 201 | """ |
| 202 | Print the list of images or source plugins. | 202 | Print the list of images or source plugins. |
| 203 | """ | 203 | """ |
| 204 | if len(args) < 1: | 204 | if args.list_type is None: |
| 205 | return False | 205 | return False |
| 206 | 206 | ||
| 207 | if args == ["images"]: | 207 | if args.list_type == "images": |
| 208 | |||
| 208 | list_canned_images(scripts_path) | 209 | list_canned_images(scripts_path) |
| 209 | return True | 210 | return True |
| 210 | elif args == ["source-plugins"]: | 211 | elif args.list_type == "source-plugins": |
| 211 | list_source_plugins() | 212 | list_source_plugins() |
| 212 | return True | 213 | return True |
| 213 | elif len(args) == 2 and args[1] == "help": | 214 | elif len(args.help_for) == 1 and args.help_for[0] == 'help': |
| 214 | wks_file = args[0] | 215 | wks_file = args.list_type |
| 215 | fullpath = find_canned_image(scripts_path, wks_file) | 216 | fullpath = find_canned_image(scripts_path, wks_file) |
| 216 | if not fullpath: | 217 | if not fullpath: |
| 217 | raise WicError("No image named %s found, exiting. " | 218 | raise WicError("No image named %s found, exiting. " |
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index d6e027d253..74db05cb94 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py | |||
| @@ -56,7 +56,7 @@ def wic_help(args, usage_str, subcommands): | |||
| 56 | """ | 56 | """ |
| 57 | Subcommand help dispatcher. | 57 | Subcommand help dispatcher. |
| 58 | """ | 58 | """ |
| 59 | if len(args) == 1 or not display_help(args[1], subcommands): | 59 | if args.help_topic == None or not display_help(args.help_topic, subcommands): |
| 60 | print(usage_str) | 60 | print(usage_str) |
| 61 | 61 | ||
| 62 | 62 | ||
| @@ -82,19 +82,20 @@ def invoke_subcommand(args, parser, main_command_usage, subcommands): | |||
| 82 | Dispatch to subcommand handler borrowed from combo-layer. | 82 | Dispatch to subcommand handler borrowed from combo-layer. |
| 83 | Should use argparse, but has to work in 2.6. | 83 | Should use argparse, but has to work in 2.6. |
| 84 | """ | 84 | """ |
| 85 | if not args: | 85 | if not args.command: |
| 86 | logger.error("No subcommand specified, exiting") | 86 | logger.error("No subcommand specified, exiting") |
| 87 | parser.print_help() | 87 | parser.print_help() |
| 88 | return 1 | 88 | return 1 |
| 89 | elif args[0] == "help": | 89 | elif args.command == "help": |
| 90 | wic_help(args, main_command_usage, subcommands) | 90 | wic_help(args, main_command_usage, subcommands) |
| 91 | elif args[0] not in subcommands: | 91 | elif args.command not in subcommands: |
| 92 | logger.error("Unsupported subcommand %s, exiting\n", args[0]) | 92 | logger.error("Unsupported subcommand %s, exiting\n", args.command) |
| 93 | parser.print_help() | 93 | parser.print_help() |
| 94 | return 1 | 94 | return 1 |
| 95 | else: | 95 | else: |
| 96 | usage = subcommands.get(args[0], subcommand_error)[1] | 96 | subcmd = subcommands.get(args.command, subcommand_error) |
| 97 | subcommands.get(args[0], subcommand_error)[0](args[1:], usage) | 97 | usage = subcmd[1] |
| 98 | subcmd[0](args, usage) | ||
| 98 | 99 | ||
| 99 | 100 | ||
| 100 | ## | 101 | ## |
| @@ -795,3 +796,11 @@ DESCRIPTION | |||
| 795 | .wks files. | 796 | .wks files. |
| 796 | 797 | ||
| 797 | """ | 798 | """ |
| 799 | |||
| 800 | wic_help_help = """ | ||
| 801 | NAME | ||
| 802 | wic help - display a help topic | ||
| 803 | |||
| 804 | DESCRIPTION | ||
| 805 | Specify a help topic to display it. Topics are shown above. | ||
| 806 | """ | ||
