MCPcopy Create free account
hub / github.com/apache/mesos / format_subcommands_help

Function format_subcommands_help

src/python/cli_new/lib/cli/util.py:139–158  ·  view source on GitHub ↗

Helps format plugin subcommands for display.

(cmd)

Source from the content-addressed store, hash-verified

137
138
139def format_subcommands_help(cmd):
140 """
141 Helps format plugin subcommands for display.
142 """
143 arguments = " ".join(cmd["arguments"])
144 short_help = cmd["short_help"]
145 long_help = textwrap.dedent(cmd["long_help"].rstrip())
146 long_help = " " + "\n ".join(long_help.lstrip().split('\n'))
147 flags = cmd["flags"]
148 flags["-h --help"] = "Show this screen."
149 flag_string = ""
150
151 if list(flags.keys()) != 0:
152 longest_flag_name = max(list(flags.keys()), key=len)
153 for flag in sorted(flags.keys()):
154 num_spaces = len(longest_flag_name) - len(flag) + 2
155 flag_string += " %s%s%s\n" % (flag, " " * num_spaces, flags[flag])
156 flag_string = flag_string.rstrip()
157
158 return (arguments, short_help, long_help, flag_string)
159
160
161def join_plugin_paths(settings, config):

Callers

nothing calls this directly

Calls 4

maxFunction · 0.85
joinMethod · 0.65
listFunction · 0.50
keysMethod · 0.45

Tested by

no test coverage detected