def show_help(action, version): docs = AVAILABLE_VERSIONS[version]["help"][action] desc = AVAILABLE_VERSIONS[version]["desc"] docstr = "" for param in docs["params"]: docstr += " %s\n" % ("--" + param["name"]) docstr += Utils.split_str(" ", param["desc"], 120) helpmsg = HelpTemplate.ACTION % { "name": action, "service": "emr", "desc": desc, "params": docstr } print(helpmsg)
def tcb_action(argv, arglist): if "help" in argv: versions = sorted(AVAILABLE_VERSIONS.keys()) opt_v = "--" + OptionsDefine.Version version = versions[-1] if opt_v in argv: version = 'v' + argv[opt_v].replace('-', '') if version not in versions: print("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST)) return action_str = "" docs = AVAILABLE_VERSIONS[version]["help"] desc = AVAILABLE_VERSIONS[version]["desc"] for action, info in docs.items(): action_str += " %s\n" % action action_str += Utils.split_str(" ", info["desc"], 120) helpstr = HelpTemplate.SERVICE % {"name": "tcb", "desc": desc, "actions": action_str} print(helpstr) else: print(ErrorMsg.FEW_ARG)
def doc_description(self, description): self.write( Utils.split_str(self.style.spaces(), description, 120 - self.style.spaces_count).rstrip())
def doc_description_indent(self, description): self.style.indent() self.write( Utils.split_str(self.style.spaces(), description, 120 - self.style.spaces_count)) self.style.dedent()