mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 01:28:56 +00:00
Merge e652200e0a735dc12ec672ef773bcb999c17b5ca into abbbd1f8eb8e87a942180edf8b13ad757b1cf68a
This commit is contained in:
commit
8897dcadf1
@ -18,4 +18,4 @@ def test_not_match(command):
|
|||||||
|
|
||||||
|
|
||||||
def test_get_new_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'
|
||||||
|
@ -10,4 +10,4 @@ def match(command, settings):
|
|||||||
|
|
||||||
@sudo_support
|
@sudo_support
|
||||||
def get_new_command(command, settings):
|
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
9
thefuck/rules/rmdir.py
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user