The rule now matches all possible lower case options and only those, not failing for those that cannot be fixed.
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
from thefuck.specific.archlinux import archlinux_env
|
||||
from thefuck.specific.sudo import sudo_support
|
||||
from thefuck.utils import for_app
|
||||
import re
|
||||
|
||||
|
||||
@sudo_support
|
||||
@for_app("pacman")
|
||||
def match(command):
|
||||
return "error: invalid option '-s'" in command.output
|
||||
return command.output.startswith("error: invalid option '-") and any(
|
||||
" -{}".format(option) in command.script for option in "surqfdvt"
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
opt = re.findall(r" -[dqrstuf]", command.script)[0]
|
||||
return re.sub(opt, opt.upper(), command.script)
|
||||
option = re.findall(r" -[dfqrstuv]", command.script)[0]
|
||||
return re.sub(option, option.upper(), command.script)
|
||||
|
||||
|
||||
enabled_by_default = archlinux_env()
|
||||
|
||||
Reference in New Issue
Block a user