Add help output to each subcommand.
This is the same as the output at the top level, just trimmed down to
only the options for a single subcommand. It's trigged by providing
"help" or "--help" as a subcommand option.
(cherry picked from commit 954f330ace
)
This commit is contained in:
parent
eba5658a71
commit
bb8fdcb854
@ -21,6 +21,7 @@ import os
|
||||
import json
|
||||
|
||||
from composer import http_client as client
|
||||
from composer.cli.help import blueprints_help
|
||||
from composer.cli.utilities import argify, frozen_toml_filename, toml_filename, handle_api_result
|
||||
from composer.cli.utilities import packageNEVRA
|
||||
|
||||
@ -48,7 +49,10 @@ def blueprints_cmd(opts):
|
||||
"undo": blueprints_undo,
|
||||
"workspace": blueprints_workspace
|
||||
}
|
||||
if opts.args[1] not in cmd_map:
|
||||
if opts.args[1] == "help" or opts.args[1] == "--help":
|
||||
print(blueprints_help)
|
||||
return 0
|
||||
elif opts.args[1] not in cmd_map:
|
||||
log.error("Unknown blueprints command: %s", opts.args[1])
|
||||
return 1
|
||||
|
||||
|
@ -21,6 +21,7 @@ import sys
|
||||
import json
|
||||
|
||||
from composer import http_client as client
|
||||
from composer.cli.help import compose_help
|
||||
from composer.cli.utilities import argify, handle_api_result, packageNEVRA
|
||||
|
||||
def compose_cmd(opts):
|
||||
@ -46,7 +47,10 @@ def compose_cmd(opts):
|
||||
"logs": compose_logs,
|
||||
"image": compose_image,
|
||||
}
|
||||
if opts.args[1] not in cmd_map:
|
||||
if opts.args == "help" or opts.args == "--help":
|
||||
print(compose_help)
|
||||
return 0
|
||||
elif opts.args[1] not in cmd_map:
|
||||
log.error("Unknown compose command: %s", opts.args[1])
|
||||
return 1
|
||||
|
||||
|
@ -20,6 +20,7 @@ log = logging.getLogger("composer-cli")
|
||||
import json
|
||||
|
||||
from composer import http_client as client
|
||||
from composer.cli.help import modules_help
|
||||
|
||||
def modules_cmd(opts):
|
||||
"""Process modules commands
|
||||
@ -29,7 +30,10 @@ def modules_cmd(opts):
|
||||
:returns: Value to return from sys.exit()
|
||||
:rtype: int
|
||||
"""
|
||||
if opts.args[1] != "list":
|
||||
if opts.args[1] == "help" or opts.args[1] == "--help":
|
||||
print(modules_help)
|
||||
return 0
|
||||
elif opts.args[1] != "list":
|
||||
log.error("Unknown modules command: %s", opts.args[1])
|
||||
return 1
|
||||
|
||||
|
@ -21,6 +21,7 @@ import json
|
||||
import textwrap
|
||||
|
||||
from composer import http_client as client
|
||||
from composer.cli.help import projects_help
|
||||
|
||||
def projects_cmd(opts):
|
||||
"""Process projects commands
|
||||
@ -34,7 +35,10 @@ def projects_cmd(opts):
|
||||
"list": projects_list,
|
||||
"info": projects_info,
|
||||
}
|
||||
if opts.args[1] not in cmd_map:
|
||||
if opts.args[1] == "help" or opts.args[1] == "--help":
|
||||
print(projects_help)
|
||||
return 0
|
||||
elif opts.args[1] not in cmd_map:
|
||||
log.error("Unknown projects command: %s", opts.args[1])
|
||||
return 1
|
||||
|
||||
|
@ -21,6 +21,7 @@ import os
|
||||
import json
|
||||
|
||||
from composer import http_client as client
|
||||
from composer.cli.help import sources_help
|
||||
from composer.cli.utilities import argify, handle_api_result
|
||||
|
||||
def sources_cmd(opts):
|
||||
@ -38,7 +39,10 @@ def sources_cmd(opts):
|
||||
"change": sources_add,
|
||||
"delete": sources_delete,
|
||||
}
|
||||
if opts.args[1] not in cmd_map:
|
||||
if opts.args[1] == "help" or opts.args[1] == "--help":
|
||||
print(sources_help)
|
||||
return 0
|
||||
elif opts.args[1] not in cmd_map:
|
||||
log.error("Unknown sources command: %s", opts.args[1])
|
||||
return 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user