mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 01:28:56 +00:00
16 lines
486 B
Python
16 lines
486 B
Python
import re
|
|
|
|
|
|
def match(command, settings):
|
|
return ('git' in command.script
|
|
and 'did not match any file(s) known to git.' in command.stderr
|
|
and "Did you forget to 'git add'?" not in command.stderr)
|
|
|
|
|
|
def get_new_command(command, settings):
|
|
missing_file = re.findall(
|
|
r"error: pathspec '([^']*)' "
|
|
"did not match any file\(s\) known to git.", command.stderr)[0]
|
|
|
|
return 'git branch {} && {}'.format(missing_file, command.script)
|