1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-18 00:28:43 +00:00
thefuck/thefuck/rules/chmod_x.py
2017-08-31 17:58:56 +02:00

16 lines
430 B
Python

import os
from thefuck.shells import shell
def match(command):
return (command.script.startswith('./')
and 'permission denied' in command.output.lower()
and os.path.exists(command.script_parts[0])
and not os.access(command.script_parts[0], os.X_OK))
def get_new_command(command):
return shell.and_(
'chmod +x {}'.format(command.script_parts[0][2:]),
command.script)