mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
oops...
This commit is contained in:
parent
faddd741ff
commit
acb901a6d9
@ -1,23 +1,14 @@
|
|||||||
try:
|
patterns = ['FATA[0000]',
|
||||||
import CommandNotFound
|
]
|
||||||
except ImportError:
|
|
||||||
enabled_by_default = False
|
|
||||||
|
|
||||||
|
|
||||||
def match(command, settings):
|
def match(command, settings):
|
||||||
if 'not found' in command.stderr:
|
for pattern in patterns:
|
||||||
try:
|
if pattern.lower() in command.stderr.lower()\
|
||||||
c = CommandNotFound.CommandNotFound()
|
or pattern.lower() in command.stdout.lower():
|
||||||
pkgs = c.getPackages(command.script.split(" ")[0])
|
|
||||||
name, _ = pkgs[0]
|
|
||||||
return True
|
return True
|
||||||
except IndexError:
|
return False
|
||||||
# IndexError is thrown when no matching package is found
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def get_new_command(command, settings):
|
def get_new_command(command, settings):
|
||||||
c = CommandNotFound.CommandNotFound()
|
return u'sudo {}'.format(command.script)
|
||||||
pkgs = c.getPackages(command.script.split(" ")[0])
|
|
||||||
name, _ = pkgs[0]
|
|
||||||
return "sudo docker {} && {}".format(name, command.script)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user