Add the pacman_not_found rule

This commit is contained in:
mcarton
2015-08-12 18:10:26 +02:00
parent 986bbb30a7
commit ca8222e764
4 changed files with 75 additions and 3 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ def get_pkgfile(command):
instead.
"""
try:
command = command.script.strip()
command = command.strip()
if command.startswith('sudo '):
command = command[5:]
+2 -2
View File
@@ -3,11 +3,11 @@ from thefuck import shells
def match(command, settings):
return 'not found' in command.stderr and get_pkgfile(command)
return 'not found' in command.stderr and get_pkgfile(command.script)
def get_new_command(command, settings):
packages = get_pkgfile(command)
packages = get_pkgfile(command.script)
formatme = shells.and_('{} -S {}', '{}')
return [formatme.format(pacman, package, command.script)
+24
View File
@@ -0,0 +1,24 @@
""" Fixes wrong package names with pacman or yaourt.
For example the `llc` program is in package `llvm` so this:
yaourt -S llc
should be:
yaourt -S llvm
"""
from thefuck.utils import replace_command
from thefuck.archlinux import archlinux_env, get_pkgfile
def match(command, settings):
return (command.script.startswith(('pacman', 'sudo pacman', 'yaourt'))
and 'error: target not found:' in command.stderr)
def get_new_command(command, settings):
pgr = command.script.split()[-1]
return replace_command(command, pgr, get_pkgfile(pgr))
enabled_by_default, _ = archlinux_env()