def commands_arguments_mapper(): mapper = [] commands = get_all_commands() for command_class in commands: command = command_class() mapper.append( (command.cli_command_name(), command) ) return mapper
def generate_dosctring(): commands_documentation = [] options_documentation = [] commands = get_all_commands() for command_class in commands: command = command_class() command_doc = command.cli_command_doc() if command_doc: commands_documentation.append(command_doc) comand_options_docs = command.cli_command_options_doc() if comand_options_docs: options_documentation.append(comand_options_docs) return Template(__doc__).render( command_docs=commands_documentation, command_options=options_documentation, app_name=sys.argv[0] )