1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-31 10:11:14 +00:00

Added side_effect to support destroying system

This commit is contained in:
Yoav Tzelnick 2019-11-01 02:38:32 +02:00
parent 3407a2f741
commit 69a1641a3c
No known key found for this signature in database
GPG Key ID: 03A2C2EC8B8E9782

View File

@ -1,3 +1,5 @@
import sys
from warnings import warn
from thefuck.specific.sudo import sudo_support
enabled_by_default = False
@ -9,6 +11,16 @@ def match(command):
and {'rm', '/'}.issubset(command.script_parts))
@sudo_support
def get_new_command(command):
return u'echo "I\'m saving your life. Thank me later"'
return '{} {} {}'.format(command.script_parts[0], '-rf', ' '.join(command.script_parts[1:]))
def side_effect(old_cmd, command):
warn("DANGER!!! THIS MAY DESTROY YOUR SYSTEM! ARE YOU SURE? (y/N): ")
try:
input = raw_input
except NameError:
pass
reply = input().strip().lower() # raw_input should be used in Python 2
if not reply or reply[0] != "y":
sys.exit(0)