1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-22 12:58:33 +00:00

Merge pull request #706 from scorphus/pull-request-701

Fix minor issues with git_remote_delete
This commit is contained in:
Vladimir Iakovlev 2017-10-09 18:47:13 +02:00 committed by GitHub
commit b1730ed8e1
2 changed files with 10 additions and 6 deletions

View File

@ -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

View File

@ -1,12 +1,13 @@
from thefuck.utils import replace_argument import re
from thefuck.specific.git import git_support from thefuck.specific.git import git_support
@git_support @git_support
def match(command): def match(command):
return "git remote delete" in command.script return "remote delete" in command.script
@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)