mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
fix small tweak
This commit is contained in:
parent
2ca0e4d968
commit
6227299d07
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
from thefuck.utils import get_all_executables, memoize
|
from thefuck.utils import get_all_executables, memoize
|
||||||
|
|
||||||
|
|
||||||
@ -8,23 +7,12 @@ def _get_executable(script_part):
|
|||||||
if script_part.startswith(executable):
|
if script_part.startswith(executable):
|
||||||
if executable.startswith("apt"):
|
if executable.startswith("apt"):
|
||||||
if script_part.startswith("apt-get"):
|
if script_part.startswith("apt-get"):
|
||||||
|
if len(script_part)> len("apt-get"):
|
||||||
return "apt-get"
|
return "apt-get"
|
||||||
count = 0
|
|
||||||
if "g" in script_part:
|
|
||||||
count += 1
|
|
||||||
if "e" in script_part:
|
|
||||||
count += 1
|
|
||||||
if script_part.find("t", 3, -1) != -1:
|
|
||||||
count += 1
|
|
||||||
if "-" in script_part:
|
|
||||||
count += 1
|
|
||||||
if count < 3 or len(script_part) > count + 4:
|
|
||||||
return executable
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
return
|
||||||
return executable
|
return executable
|
||||||
|
|
||||||
|
|
||||||
def match(command):
|
def match(command):
|
||||||
return (not command.script_parts[0] in get_all_executables()
|
return (not command.script_parts[0] in get_all_executables()
|
||||||
and _get_executable(command.script_parts[0]))
|
and _get_executable(command.script_parts[0]))
|
||||||
@ -37,3 +25,10 @@ def get_new_command(command):
|
|||||||
|
|
||||||
priority = 4000
|
priority = 4000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user