def get_project_command(): command = { 'command': 'project', 'options': None, 'subcommands': [], 'sub_title': 'project commands', 'sub_dest': 'project', 'sub_extras': {} } define_subcommand = [] for comp, val in project_components.items(): com_ = {'command': comp} if val: com_['options'] = [{'name': '-{}'.format(l), 'required': False} for l in val] com = profile_utils._create_namedtuple('SubCommand', com_) define_subcommand.append(com) for k, v in six.iteritems(subcommands): com_ = {'command': k} if v: com_['options'] = [{'name': '-{}'.format(l), 'required': False} for l in v] #com_['group_name'] = 'project {} group'.format(k) if k == 'define': com_.update(sub_title='define_components') com_.update(sub_dest='component') com_.update(sub_extras={}) com_.update(subcommands=define_subcommand) com = profile_utils._create_namedtuple('SubCommand', com_) command['subcommands'].append(com) return command
def get_cli_commands(): commands = [ {'command': 'configure', 'options': [{'name': '--with', 'choices': ('login', 'authenticate'), 'required': False, 'dest': 'include'}, {'name': '--log', 'action': 'store_true'}]}, {'command': 'login', 'options': None}, {'command': 'logout', 'options': None}, {'command': 'authenticate', 'options': None}, {'command': 'my-profile', 'options': None}, {'command': 'flush-log', 'options': None} ] components = component_commands() commands = itertools.chain(commands, [{'command': d['command'], 'options': d['options']} for d in components]) all_commands = [profile_utils._create_namedtuple('CliCommandsConfig', d) for d in commands] project_commands = project_driver.get_project_cli_commands() all_commands = itertools.chain(all_commands, project_commands) return all_commands
def _prepare_method_args(meth_name, **kwargs): val = {'method': meth_name} val.update(arguments=kwargs) return profile_utils._create_namedtuple('MethodArgs', val)
def get_project_cli_commands(): command = get_project_command() return (profile_utils._create_namedtuple('CliCommandsConfig', command),)