Helps format plugin subcommands for display.
(cmd)
| 137 | |
| 138 | |
| 139 | def 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 | |
| 161 | def join_plugin_paths(settings, config): |