add git-lfs support (#1056)

* add mistyping support for git lfs

* add the rule

* fix flake8

* flake8

* add to readme

* use fixtures and regex

* get rid of additional matched strings
This commit is contained in:
Connor Martin
2020-06-10 17:20:37 -05:00
committed by GitHub
parent 6975d30818
commit f82176802e
3 changed files with 48 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import re
from thefuck.utils import get_all_matched_commands, replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
'''
Match a mistyped command
'''
return 'lfs' in command.script and 'Did you mean this?' in command.output
@git_support
def get_new_command(command):
broken_cmd = re.findall(r'Error: unknown command "([^"]*)" for "git-lfs"', command.output)[0]
matched = get_all_matched_commands(command.output, ['Did you mean', ' for usage.'])
return replace_command(command, broken_cmd, matched)