本文整理汇总了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)
示例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)
示例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)
示例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 []
示例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
示例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())
示例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)
示例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)
示例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())
示例10: get_new_command
def get_new_command(command):
misspelled_command = regex.findall(command.output)[0]
return replace_command(command, misspelled_command, _get_operations())
示例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))
示例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)
示例13: get_new_command
def get_new_command(command):
pgr = command.script.split()[-1]
return replace_command(command, pgr, get_pkgfile(pgr))
示例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)
示例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)