1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-31 02:01:13 +00:00
thefuck/thefuck/rules/git_bisect_usage.py
2017-08-31 17:58:56 +02:00

17 lines
485 B
Python

import re
from thefuck.utils import replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('bisect' in command.script_parts and
'usage: git bisect' in command.output)
@git_support
def get_new_command(command):
broken = re.findall(r'git bisect ([^ $]*).*', command.script)[0]
usage = re.findall(r'usage: git bisect \[([^\]]+)\]', command.output)[0]
return replace_command(command, broken, usage.split('|'))