Files
thefuck/thefuck/rules/sudo.py
T
Trace a2ac15da56 Added dpkg rule
For example, when using ```dpkg -i some-pkg.deb```
2015-04-27 17:45:59 -05:00

23 lines
749 B
Python

patterns = ['permission denied',
'EACCES',
'pkg: Insufficient privileges',
'you cannot perform this operation unless you are root',
'non-root users cannot',
'Operation not permitted',
'root privilege',
'This command has to be run under the root user.',
'This operation requires root.',
'You need to be root to perform this command.',
'requested operation requires superuser privilege']
def match(command, settings):
for pattern in patterns:
if pattern.lower() in command.stderr.lower():
return True
return False
def get_new_command(command, settings):
return u'sudo {}'.format(command.script)