1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-04-17 08:10:47 +01:00
thefuck/thefuck/fix_git_and_command_misspell.py
2018-04-15 18:55:01 -04:00

17 lines
593 B
Python

from difflib import get_close_matches
def fix_git_command(git_command):
git_possible = ['clone', 'init', 'add', 'mv', 'reset', 'rm', 'bisect',
'grep', 'log', 'show', 'status', 'branch', 'checkout',
'commit', 'diff', 'merge', 'rebase', 'tag', 'fetch',
'pull', 'push']
if git_command not in git_possible[0]:
close_match = get_close_matches(git_command, git_possible)
if len(close_match) > 0:
return close_match[0]
else:
return git_command
else:
return git_command