当前位置: 首页>>代码示例>>Python>>正文


Python utils.replace_command函数代码示例

本文整理汇总了Python中thefuck.utils.replace_command函数的典型用法代码示例。如果您正苦于以下问题:Python replace_command函数的具体用法?Python replace_command怎么用?Python replace_command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了replace_command函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_new_command

def get_new_command(command):
    cmd = re.match(r"ambiguous command: (.*), could be: (.*)",
                   command.stderr)

    old_cmd = cmd.group(1)
    suggestions = [cmd.strip() for cmd in cmd.group(2).split(',')]

    return replace_command(command, old_cmd, suggestions)
开发者ID:DJMIN,项目名称:thefuck,代码行数:8,代码来源:tmux.py

示例2: get_new_command

def get_new_command(command):
    misspelled_task = regex.findall(command.output)[0]
    if misspelled_task in npm_commands:
        yarn_command = npm_commands[misspelled_task]
        return replace_argument(command.script, misspelled_task, yarn_command)
    else:
        tasks = _get_all_tasks()
        return replace_command(command, misspelled_task, tasks)
开发者ID:Clpsplug,项目名称:thefuck,代码行数:8,代码来源:yarn_command_not_found.py

示例3: get_new_command

def get_new_command(command):
    if no_website in command.stderr:
        return ['hostscli websites']

    misspelled_command = re.findall(
        r'Error: No such command ".*"', command.stderr)[0]
    commands = ['block', 'unblock', 'websites', 'block_all', 'unblock_all']
    return replace_command(command, misspelled_command, commands)
开发者ID:Googulator,项目名称:thefuck,代码行数:8,代码来源:hostscli.py

示例4: get_new_command

def get_new_command(command):
    failed_lifecycle = _get_failed_lifecycle(command)
    available_lifecycles = _getavailable_lifecycles(command)
    if available_lifecycles and failed_lifecycle:
        selected_lifecycle = get_close_matches(
            failed_lifecycle.group(1), available_lifecycles.group(1).split(", "))
        return replace_command(command, failed_lifecycle.group(1), selected_lifecycle)
    else:
        return []
开发者ID:alexandre-paroissien,项目名称:thefuck,代码行数:9,代码来源:mvn_unknown_lifecycle_phase.py

示例5: get_new_command

def get_new_command(command):
    misspelled_env = command.script_parts[1]
    create_new = u"mkvirtualenv {}".format(misspelled_env)

    available = _get_all_environments()
    if available:
        return replace_command(command, misspelled_env, available) + [create_new]
    else:
        return create_new
开发者ID:liu4480,项目名称:thefuck,代码行数:9,代码来源:workon_doesnt_exists.py

示例6: get_new_command

def get_new_command(command):
    wrong_task = re.findall(r"Task '(\w+)' is not in your gulpfile",
                            command.stdout)[0]
    return replace_command(command, wrong_task, get_gulp_tasks())
开发者ID:AdmiralAwesome,项目名称:thefuck,代码行数:4,代码来源:gulp_not_task.py

示例7: get_new_command

def get_new_command(command):
    misspelled_command = re.findall(r'Command `(.*)` unrecognized',
                                    command.stderr)[0]
    commands = re.findall(r'  - (.*): .*\n', command.stdout)
    return replace_command(command, misspelled_command, commands)
开发者ID:Googulator,项目名称:thefuck,代码行数:5,代码来源:react_native_command_unrecognized.py

示例8: get_new_command

def get_new_command(command):
    unknown_command = _get_unknown_command(command)
    all_commands = _get_all_commands()
    return replace_command(command, unknown_command, all_commands)
开发者ID:Googulator,项目名称:thefuck,代码行数:4,代码来源:gem_unknown_command.py

示例9: get_new_command

def get_new_command(command, settings):
    wrong_command = re.findall(
        r"docker: '(\w+)' is not a docker command.", command.stderr)[0]
    return replace_command(command, wrong_command, get_docker_commands())
开发者ID:ngphat,项目名称:thefuck,代码行数:4,代码来源:docker_not_command.py

示例10: get_new_command

def get_new_command(command):
    misspelled_command = regex.findall(command.output)[0]
    return replace_command(command, misspelled_command, _get_operations())
开发者ID:alexandre-paroissien,项目名称:thefuck,代码行数:3,代码来源:dnf_no_such_command.py

示例11: get_new_command

def get_new_command(command):
    broken_cmd = re.findall(r'tsuru: "([^"]*)" is not a tsuru command',
                            command.stderr)[0]
    return replace_command(command, broken_cmd,
                           get_all_matched_commands(command.stderr))
开发者ID:AdmiralAwesome,项目名称:thefuck,代码行数:5,代码来源:tsuru_not_command.py

示例12: get_new_command

def get_new_command(command):
    misspelled_command = re.findall(r"Unrecognized command '(.*)'",
                                    command.output)[0]
    commands = _get_commands()
    return replace_command(command, misspelled_command, commands)
开发者ID:Clpsplug,项目名称:thefuck,代码行数:5,代码来源:react_native_command_unrecognized.py

示例13: get_new_command

def get_new_command(command):
    pgr = command.script.split()[-1]

    return replace_command(command, pgr, get_pkgfile(pgr))
开发者ID:DJMIN,项目名称:thefuck,代码行数:4,代码来源:pacman_not_found.py

示例14: get_new_command

def get_new_command(command):
    broken_cmd = re.findall(r"git: '([^']*)' is not a git command",
                            command.stderr)[0]
    matched = get_all_matched_commands(command.stderr, ['The most similar command', 'Did you mean'])
    return replace_command(command, broken_cmd, matched)
开发者ID:Googulator,项目名称:thefuck,代码行数:5,代码来源:git_not_command.py

示例15: get_new_command

def get_new_command(command, settings):
    broken_cmd = re.findall(r"'([^']*)' is not a task",
                            command.stderr)[0]
    new_cmds = get_all_matched_commands(command.stderr, 'Did you mean this?')
    return replace_command(command, broken_cmd, new_cmds)
开发者ID:bugaevc,项目名称:thefuck,代码行数:5,代码来源:lein_not_task.py


注:本文中的thefuck.utils.replace_command函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。