def fish_completions(): tasks = list_commands('', 'normal') tasks.pop(0) for task in tasks: print task.strip() conf = configuration.getAll() for key in conf['hosts'].keys(): print "config:" + key print "copyFrom:" + key print "copyDBFrom:" + key print "copyFilesFrom:" + key if 'scripts' in conf: for key in conf['scripts'].keys(): print "script:" + key if 'dockerHosts' in conf: tasks = set() for key in conf['dockerHosts'].keys(): docker_conf = configuration.getDockerConfig(key, False, False) if docker_conf: tasks.update(methods.getMethod('docker').getInternalCommands() + docker_conf['tasks'].keys()) for key in tasks: print "docker:" + key
def fish_completions(): tasks = list_commands('', 'normal') tasks.pop(0) for task in tasks: print task.strip() conf = configuration.getAll() for key in conf['hosts'].keys(): print "config:" + key print "copyFrom:" + key print "copyDBFrom:" + key print "copyFilesFrom:" + key print "installFrom:" + key if 'scripts' in conf: for key in conf['scripts'].keys(): print "script:" + key if 'dockerHosts' in conf: tasks = set() for key in conf['dockerHosts'].keys(): docker_conf = configuration.getDockerConfig(key, False, False) if docker_conf: tasks.update(methods.getMethod('docker').getInternalCommands() + docker_conf['tasks'].keys()) for key in tasks: print "docker:" + key
def help(): # print("called!") commands = list_commands(None, "nested") support_type = ['cmd', 'cloud', 'classic', 'config', 'io', 'py', 'git'] ignore = ['Dumper', 'Loader', 'bind_cloud', 'bind_hosts', 'dump', 'dump_codes'] origin = ['Available commands:'] print(commands) # commands.split("\n") return # for c in commands_buff: compare = c.strip() print(compare) if compare in ignore: continue if compare in origin: print(c) continue # print(" " + c) pass
def help(): # print("called!") commands = list_commands(None, "nested") support_type = ['cmd', 'cloud', 'classic', 'config', 'io', 'py', 'git'] ignore = [ 'Dumper', 'Loader', 'bind_cloud', 'bind_hosts', 'dump', 'dump_codes' ] origin = ['Available commands:'] print(commands) # commands.split("\n") return # for c in commands_buff: compare = c.strip() print(compare) if compare in ignore: continue if compare in origin: print(c) continue # print(" " + c) pass
def usage(): """ Prints this usage information """ puts("usage: fab host.HOST TASK[:OPTIONS]") puts("See the list below for available host.HOST and TASK choices.") puts("Use fab -d TASK for a list of that task's available options.") puts("\n".join(list_commands("", "normal")))
def display_fabric_tasks(): paths = find_fabfile() docstring, callables, default = load_fabfile(paths) callables.pop('setup', None) state.commands.update(callables) commands = list_commands(docstring, 'normal') print("\n".join(commands))
def prompt_for_command(): import fabric.state from fabric.main import list_commands, _task_names command_list = [ cmd for cmd in list_commands('No command supplied!', 'normal') if not cmd.startswith(' prompt_for_command') and re.subn(r'^ ([^\s]+).*', r'\1', cmd)[0] not in stages.STAGE_NAMES ] print '\n'.join(command_list) + '\n' cmd = None while cmd is None: cmd = prompt(white('Please select a command:', bold=True)).strip() if cmd == 'prompt_for_command': print "Stop being an ass." cmd = None elif cmd not in _task_names(fabric.state.commands): print "%r is not a valid command!" % cmd cmd = None execute(cmd)
def polish(env='dev'): """Polish code by running some or all sniffs :param env: Environment to determine what all sniffs to run Options: 'dev', 'ci' Default: 'dev' :type env: str When environment is 'ci', all the sniffs registered are run. When environment is 'dev', only fast-critical and fast-major sniffs are run. """ fabric_tasks = list_commands('', 'short') results = list() with settings(warn_only=True): if env == 'ci': sniffs_to_run = [] for sniff in _sniffs: if sniff['function'].name not in fabric_tasks: continue sniffs_to_run.append(sniff) elif env == 'dev': sniffs_to_run = [] for sniff in _sniffs: if sniff['function'].name not in fabric_tasks: continue if sniff['timing'] != 'fast': continue if sniff['severity'] not in ('critical', 'major'): continue sniffs_to_run.append(sniff) else: raise ValueError('env must be one of: ' + str(['dev', 'ci'])) for sniff in sniffs_to_run: results.append(sniff['function']()) if any(result.failed for result in results): sys.exit(1)
def eq_output(docstring, format_, expected): return eq_( "\n".join(list_commands(docstring, format_)), expected )
def eq_output(docstring, format_, expected): return eq_("\n".join(list_commands(docstring, format_)), expected)