1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-04-14 23:00:45 +01:00
2015-04-22 09:26:45 +08:00

21 lines
640 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.',
'You need to be root to perform this command.']
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)