mirror of
https://github.com/nvbn/thefuck.git
synced 2025-04-18 08:40:44 +01:00
19 lines
533 B
Python
19 lines
533 B
Python
from thefuck.utils import get_all_executables, memoize
|
|
|
|
|
|
@memoize
|
|
def _get_executable(script_part):
|
|
for executable in get_all_executables():
|
|
if script_part.startswith(executable):
|
|
return executable
|
|
|
|
|
|
def match(command):
|
|
return (not command.script_parts[0] in get_all_executables()
|
|
and _get_executable(command.script_parts[0]))
|
|
|
|
|
|
def get_new_command(command):
|
|
executable = _get_executable(command.script_parts[0])
|
|
return command.script.replace(executable, u'{} '.format(executable), 1)
|