mirror of
https://github.com/nvbn/thefuck.git
synced 2025-11-18 15:56:00 +00:00
19 lines
512 B
Python
19 lines
512 B
Python
from thefuck.specific.sudo import sudo_support
|
|
# add 'python' suffix to the command if
|
|
# 1) The script does not have execute permission or
|
|
# 2) is interpreted as shell script
|
|
|
|
|
|
@sudo_support
|
|
def match(command):
|
|
toks = command.script.split()
|
|
return (len(toks) > 0
|
|
and toks[0].endswith('.py')
|
|
and ('Permission denied' in command.stderr or
|
|
'command not found' in command.stderr))
|
|
|
|
|
|
@sudo_support
|
|
def get_new_command(command):
|
|
return 'python ' + command.script
|