Files
thefuck/thefuck/rules/rm_dir.py
T
2017-08-31 17:58:56 +02:00

17 lines
390 B
Python

import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return ('rm' in command.script
and 'is a directory' in command.output.lower())
@sudo_support
def get_new_command(command):
arguments = '-rf'
if 'hdfs' in command.script:
arguments = '-r'
return re.sub('\\brm (.*)', 'rm ' + arguments + ' \\1', command.script)