1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-18 20:11:17 +00:00

Merge pull request #701 from Epse/#670-git_remote_delete

fixed #670
This commit is contained in:
Vladimir Iakovlev 2017-10-08 16:25:59 +02:00 committed by GitHub
commit 6362c37eec
3 changed files with 37 additions and 0 deletions

View File

@ -199,6 +199,7 @@ using the matched rule and runs it. Rules enabled by default are as follows:
* `git_push_pull` – runs `git pull` when `push` was rejected;
* `git_push_without_commits` – Creates an initial commit if you forget and only `git add .`, when setting up a new project;
* `git_rebase_no_changes` – runs `git rebase --skip` instead of `git rebase --continue` when there are no changes;
* `git_remote_delete` – replaces `git remote delete remote_name` with `git remote remove remote_name`
* `git_rm_local_modifications` – adds `-f` or `--cached` when you try to `rm` a locally modified file;
* `git_rm_recursive` – adds `-r` when you try to `rm` a directory;
* `git_rm_staged` – adds `-f` or `--cached` when you try to `rm` a file with staged changes

View File

@ -0,0 +1,21 @@
import pytest
from thefuck.rules.git_remote_delete import get_new_command, match
from thefuck.types import Command
def test_match():
assert match(Command('git remote delete foo', ''))
@pytest.mark.parametrize('command', [
Command('git remote remove foo', ''),
Command('git remote add foo', ''),
Command('git commit', '')
])
def test_not_match(command):
assert not match(command)
def test_get_new_command():
new_command = get_new_command(Command('git remote delete foo', ''))
assert new_command == 'git remote remove foo'

View File

@ -0,0 +1,15 @@
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return "git remote delete" in command.script
@git_support
def get_new_command(command):
return replace_argument(command.script, "delete", "remove")
enabled_by_default = True