mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 02:01:13 +00:00
Update chmod_x to work with non-relative paths
Originally this rule only worked for scripts run with relative paths (eg `./funStuff.sh`) but that's not always what we need Imagine I have a file at `/home/alice/scripts/funStuff.sh` and my cwd is `/home/alice` I could run the script with `./scripts/funStuff.sh` or '~/scripts/funStuff.sh` or `/home/alice/scripts/funStuff.sh`
This commit is contained in:
parent
c7e7e1d884
commit
7fe4c309a7
@ -3,10 +3,9 @@ from thefuck.shells import shell
|
|||||||
|
|
||||||
|
|
||||||
def match(command):
|
def match(command):
|
||||||
return (command.script.startswith('./')
|
return ('permission denied' in command.output.lower()
|
||||||
and 'permission denied' in command.output.lower()
|
and os.path.exists(os.path.expanduser(command.script_parts[0]))
|
||||||
and os.path.exists(command.script_parts[0])
|
and not os.access(os.path.expanduser(command.script_parts[0]), os.X_OK))
|
||||||
and not os.access(command.script_parts[0], os.X_OK))
|
|
||||||
|
|
||||||
|
|
||||||
def get_new_command(command):
|
def get_new_command(command):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user