1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

Merge e652200e0a735dc12ec672ef773bcb999c17b5ca into abbbd1f8eb8e87a942180edf8b13ad757b1cf68a

This commit is contained in:
Jens Timmerman 2015-08-19 20:03:53 +00:00
commit 8897dcadf1
3 changed files with 11 additions and 2 deletions

View File

@ -18,4 +18,4 @@ def test_not_match(command):
def test_get_new_command():
assert get_new_command(Command('rm foo', '', ''), None) == 'rm -rf foo'
assert get_new_command(Command('rm foo', '', ''), None) == 'rmdir foo'

View File

@ -10,4 +10,4 @@ def match(command, settings):
@sudo_support
def get_new_command(command, settings):
return re.sub('^rm (.*)', 'rm -rf \\1', command.script)
return re.sub('^rm (.*)', 'rmdir \\1', command.script)

9
thefuck/rules/rmdir.py Normal file
View File

@ -0,0 +1,9 @@
import re
def match(command, settings):
return ('rmdir' in command.script
and 'Directory not empty' in command.stderr)
def get_new_command(command, settings):
return re.sub('^rm (.*)', 'rm -rf \\1', command.script)