1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-04-15 15:20:42 +01:00
thefuck/thefuck/rules/rm_root.py
2015-10-29 00:13:59 +08:00

17 lines
423 B
Python

from thefuck.specific.sudo import sudo_support
enabled_by_default = False
@sudo_support
def match(command):
return (command.script_parts
and {'rm', '/'}.issubset(command.script_parts)
and '--no-preserve-root' not in command.script
and '--no-preserve-root' in command.stderr)
@sudo_support
def get_new_command(command):
return u'{} --no-preserve-root'.format(command.script)