1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-11-14 22:06:09 +00:00
Files
thefuck/thefuck/rules/git_not_command.py

18 lines
573 B
Python

import re
from thefuck.utils import get_all_matched_commands, replace_command
from thefuck.specific.git import git_support
@git_support
def match(command, settings):
return (" is not a git command. See 'git --help'." in command.stderr
and 'Did you mean' in command.stderr)
@git_support
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)