mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 07:04:12 +00:00 
			
		
		
		
	| @@ -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 | ||||
|   | ||||
							
								
								
									
										21
									
								
								tests/rules/test_git_remote_delete.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								tests/rules/test_git_remote_delete.py
									
									
									
									
									
										Normal 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' | ||||
							
								
								
									
										15
									
								
								thefuck/rules/git_remote_delete.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								thefuck/rules/git_remote_delete.py
									
									
									
									
									
										Normal 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 | ||||
		Reference in New Issue
	
	Block a user