mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 14:48:49 +00:00
Added pacman invalid option rule
This commit is contained in:
parent
3bbd0e9463
commit
7fd4f3ef74
@ -321,6 +321,7 @@ The following rules are enabled by default on specific platforms only:
|
||||
* `dnf_no_such_command` – fixes mistyped DNF commands;
|
||||
* `nixos_cmd_not_found` – installs apps on NixOS;
|
||||
* `pacman` – installs app with `pacman` if it is not installed (uses `yay` or `yaourt` if available);
|
||||
* `pacman_invalid_option` – replaces lowercase pacman options with uppercase.
|
||||
* `pacman_not_found` – fixes package name with `pacman`, `yay` or `yaourt`.
|
||||
|
||||
The following commands are bundled with *The Fuck*, but are not enabled by
|
||||
@ -352,8 +353,8 @@ Your rule should not change `Command`.
|
||||
|
||||
**Rules api changed in 3.0:** To access a rule's settings, import it with
|
||||
`from thefuck.conf import settings`
|
||||
|
||||
`settings` is a special object assembled from `~/.config/thefuck/settings.py`,
|
||||
|
||||
`settings` is a special object assembled from `~/.config/thefuck/settings.py`,
|
||||
and values from env ([see more below](#settings)).
|
||||
|
||||
A simple example rule for running a script with `sudo`:
|
||||
|
14
thefuck/rules/pacman_invalid_option.py
Normal file
14
thefuck/rules/pacman_invalid_option.py
Normal file
@ -0,0 +1,14 @@
|
||||
from thefuck.specific.archlinux import archlinux_env
|
||||
import re
|
||||
|
||||
|
||||
def match(command):
|
||||
return "error: invalid option" in command.output
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
opt = re.findall(r" -[dqrstuf]", command.script)[0]
|
||||
return re.sub(opt, opt.upper(), command.script)
|
||||
|
||||
|
||||
enabled_by_default=true, pacman = archlinux_env()
|
Loading…
x
Reference in New Issue
Block a user