• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.replace_command函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: get_new_command

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


示例17: get_new_command

def get_new_command(command, settings):
    wrong = re.findall(r'`(\w+)` is not a heroku command', command.stderr)[0]
    return replace_command(command, wrong, _get_suggests(command.stderr))
开发者ID:bugaevc,项目名称:thefuck,代码行数:3,代码来源:heroku_not_command.py


示例18: get_new_command

def get_new_command(command):
    broken_cmd = re.findall(r"([^:]*): Unknown command.*", command.stderr)[0]
    matched = re.findall(r"Did you mean ([^?]*)?", command.stderr)
    return replace_command(command, broken_cmd, matched)
开发者ID:DJMIN,项目名称:thefuck,代码行数:4,代码来源:unknown_command.py


示例19: get_new_command

def get_new_command(command):
    misspelled_script = re.findall(
        r'.*missing script: (.*)\n', command.output)[0]
    return replace_command(command, misspelled_script, get_scripts())
开发者ID:Clpsplug,项目名称:thefuck,代码行数:4,代码来源:npm_missing_script.py


示例20: get_new_command

def get_new_command(command):
    wrong_task = regex.findall(command.output)[0][0]
    all_tasks = _get_all_tasks(command.script_parts[0])
    return replace_command(command, wrong_task, all_tasks)
开发者ID:Clpsplug,项目名称:thefuck,代码行数:4,代码来源:gradle_no_task.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.BaseTool类代码示例发布时间:2022-05-27
下一篇:
Python utils.replace_argument函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap