def ajuda(comando=None): """ Exibe a ajuda para um comando "fab ajuda:nome". * comando: Nome do comando """ if comando is None: show_commands(__doc__, 'normal') else: display_command(comando)
def help(name=""): """Show extended help for a task (e.g. 'fab help:search.reindex')""" from fabric.main import show_commands if not name: puts("\nFor more information on a task run `fab help:<task>`.\n") show_commands(None, 'short') task = crawl(name, state.commands) if task is None: abort("%r is not a valid task name" % task) puts(textwrap.dedent(task.__doc__).strip())
def help(): """Usage and list of commands""" from fabric.main import show_commands show_commands(__doc__, 'normal')
def gentleman(): args_dict = docopt(__doc__, version=__version__) arguments = args_dict['COMMAND'] if not os.path.exists(os.path.join(os.getcwd(), '.gentle.yaml')): if arguments != ['init']: print(red('This is not a gentle directory, Make sure this is the correct' # noqa 'directory, and use `gt init` Initialization')) return sys.exit(1) else: init() arguments = args_dict['COMMAND'] try: # state.env.update(load_settings(state.env.rcfile)) fabfile = os.path.join(here, 'gt') state.env.real_fabfile = fabfile default = None if fabfile: docstring, callables, default = load_fabfile(fabfile) state.commands.update(callables) commands_to_run = parse_arguments(arguments) unknown_commands = [] for tup in commands_to_run: if crawl(tup[0], state.commands) is None: unknown_commands.append(tup[0]) if args_dict['--list']: show_commands(docstring, 'normal', 1) for type in ['show', 'hide']: t = args_dict['--' + type] if t is not None: hide = True if type == 'hide' else False set_output(t, hide=hide, only=args_dict['--only']) # Abort if any unknown commands were specified if unknown_commands: warn("Command(s) not found:\n%s" % indent(unknown_commands)) show_commands(None, 'normal', 1) for name, args, kwargs, arg_hosts, arg_roles, arg_exclude_hosts in \ commands_to_run: execute( name, hosts=arg_hosts, roles=arg_roles, exclude_hosts=arg_exclude_hosts, *args, **kwargs) if state.output.status: print("\nDone.") except SystemExit: raise except KeyboardInterrupt: if state.output.status: sys.stderr.write("\nStopped.\n") sys.exit(1) except: sys.excepthook(*sys.exc_info()) sys.exit(1) finally: disconnect_all() sys.exit(0)
def help(): from fabric.main import show_commands show_commands(__doc__, 'normal')