1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-04-21 10:10:43 +01:00
2015-08-26 21:43:20 +02:00

20 lines
578 B
Python

import re
from thefuck import shells
from thefuck.specific.git import git_support
@git_support
def match(command, settings):
return ('did not match any file(s) known to git.' in command.stderr
and "Did you forget to 'git add'?" in command.stderr)
@git_support
def get_new_command(command, settings):
missing_file = re.findall(
r"error: pathspec '([^']*)' "
r"did not match any file\(s\) known to git.", command.stderr)[0]
formatme = shells.and_('git add -- {}', '{}')
return formatme.format(missing_file, command.script)