mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 20:11:17 +00:00
#701: Replace the first single occurrence of delete
This commit is contained in:
parent
3253b0e789
commit
dfd0be2002
@ -16,6 +16,9 @@ def test_not_match(command):
|
|||||||
assert not match(command)
|
assert not match(command)
|
||||||
|
|
||||||
|
|
||||||
def test_get_new_command():
|
@pytest.mark.parametrize('command, new_command', [
|
||||||
new_command = get_new_command(Command('git remote delete foo', ''))
|
(Command('git remote delete foo', ''), 'git remote remove foo'),
|
||||||
assert new_command == 'git remote remove foo'
|
(Command('git remote delete delete', ''), 'git remote remove delete'),
|
||||||
|
])
|
||||||
|
def test_get_new_command(command, new_command):
|
||||||
|
assert get_new_command(command) == new_command
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from thefuck.utils import replace_argument
|
import re
|
||||||
|
|
||||||
from thefuck.specific.git import git_support
|
from thefuck.specific.git import git_support
|
||||||
|
|
||||||
|
|
||||||
@ -9,4 +10,4 @@ def match(command):
|
|||||||
|
|
||||||
@git_support
|
@git_support
|
||||||
def get_new_command(command):
|
def get_new_command(command):
|
||||||
return replace_argument(command.script, "delete", "remove")
|
return re.sub(r"delete", "remove", command.script, 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user