mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 06:38:32 +00:00
Merge 6ec28073ed18470ed47eb4fc2c086d770f742490 into 6975d30818792f1b37de702fc93c66023c4c50d5
This commit is contained in:
commit
00352ef833
@ -214,6 +214,7 @@ following rules are enabled by default:
|
||||
* `git_fix_stash` – fixes `git stash` commands (misspelled subcommand and missing `save`);
|
||||
* `git_flag_after_filename` – fixes `fatal: bad flag '...' after filename`
|
||||
* `git_help_aliased` – fixes `git help <alias>` commands replacing <alias> with the aliased command;
|
||||
* `git_log` – replaces `git lock` command with `git log`;
|
||||
* `git_merge` – adds remote to branch names;
|
||||
* `git_merge_unrelated` – adds `--allow-unrelated-histories` when required
|
||||
* `git_not_command` – fixes wrong git commands like `git brnch`;
|
||||
|
25
tests/rules/test_git_log.py
Normal file
25
tests/rules/test_git_log.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
from thefuck.rules.git_log import match, get_new_command
|
||||
from thefuck.types import Command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, output', [
|
||||
('git lock', 'git: \'lock\' is not a git command.'),
|
||||
('git lock --help', 'git: \'lock\' is not a git command.')])
|
||||
def test_match(output, script):
|
||||
assert match(Command(script, output))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script', [
|
||||
'git branch foo',
|
||||
'git checkout feature/test_commit',
|
||||
'git push'])
|
||||
def test_not_match(script):
|
||||
assert not match(Command(script, ''))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, output', [
|
||||
('git lock', 'git log'),
|
||||
('git lock --help', 'git log --help')])
|
||||
def test_get_new_command(script, output):
|
||||
assert get_new_command(Command(script, '')) == output
|
11
thefuck/rules/git_log.py
Normal file
11
thefuck/rules/git_log.py
Normal file
@ -0,0 +1,11 @@
|
||||
from thefuck.specific.git import git_support
|
||||
|
||||
|
||||
@git_support
|
||||
def match(command):
|
||||
return 'git: \'lock\' is not a git command.' in command.output
|
||||
|
||||
|
||||
@git_support
|
||||
def get_new_command(command):
|
||||
return command.script.replace('lock', 'log', 1)
|
Loading…
x
Reference in New Issue
Block a user