1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-11-19 00:05:56 +00:00
Files
thefuck/thefuck/rules/no_command.py

21 lines
624 B
Python

from difflib import get_close_matches
from thefuck.utils import sudo_support, get_all_executables
@sudo_support
def match(command, settings):
return 'not found' in command.stderr and \
bool(get_close_matches(command.script.split(' ')[0],
get_all_executables()))
@sudo_support
def get_new_command(command, settings):
old_command = command.script.split(' ')[0]
new_cmds = get_close_matches(old_command, get_all_executables(), cutoff=0.1)
return [' '.join([new_command] + command.script.split(' ')[1:])
for new_command in new_cmds]
priority = 3000