#N/A: Add chmod +x rule

This commit is contained in:
nvbn
2016-04-11 16:13:41 +03:00
parent c6af8409d9
commit c6d2766553
3 changed files with 55 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import os
from thefuck.shells import shell
def match(command):
return (command.script.startswith('./')
and 'permission denied' in command.stderr.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)