Add brew_reinstall rule (#816)
Replaces install with reinstall when a package is already installed.
This commit is contained in:
committed by
Vladimir Iakovlev
parent
f6e50bef82
commit
89207d6d7c
@@ -0,0 +1,19 @@
|
||||
import re
|
||||
from thefuck.utils import for_app
|
||||
|
||||
|
||||
warning_regex = re.compile(r'Warning: (?:.(?!is ))+ is already installed and '
|
||||
r'up-to-date')
|
||||
message_regex = re.compile(r'To reinstall (?:(?!, ).)+, run `brew reinstall '
|
||||
r'[^`]+`')
|
||||
|
||||
|
||||
@for_app('brew', at_least=2)
|
||||
def match(command):
|
||||
return ('install' in command.script
|
||||
and warning_regex.search(command.output)
|
||||
and message_regex.search(command.output))
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
return command.script.replace('install', 'reinstall')
|
||||
Reference in New Issue
Block a user