mirror of
https://github.com/nvbn/thefuck.git
synced 2025-04-16 15:50:44 +01:00
25 lines
616 B
Python
25 lines
616 B
Python
""" 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()
|