mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-07 13:41:21 +00:00
Merge pull request #214 from scorphus/improve-man
refact(man): do not match if there's no argument to man
This commit is contained in:
commit
675317b247
@ -2,6 +2,7 @@ import pytest
|
|||||||
from thefuck.rules.man import match, get_new_command
|
from thefuck.rules.man import match, get_new_command
|
||||||
from tests.utils import Command
|
from tests.utils import Command
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('command', [
|
@pytest.mark.parametrize('command', [
|
||||||
Command('man read'),
|
Command('man read'),
|
||||||
Command('man 2 read'),
|
Command('man 2 read'),
|
||||||
@ -14,6 +15,13 @@ def test_match(command):
|
|||||||
assert match(command, None)
|
assert match(command, None)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('command', [
|
||||||
|
Command('man'),
|
||||||
|
Command('man ')])
|
||||||
|
def test_not_match(command):
|
||||||
|
assert not match(command, None)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('command, new_command', [
|
@pytest.mark.parametrize('command, new_command', [
|
||||||
(Command('man read'), 'man 3 read'),
|
(Command('man read'), 'man 3 read'),
|
||||||
(Command('man 2 read'), 'man 3 read'),
|
(Command('man 2 read'), 'man 3 read'),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
def match(command, settings):
|
def match(command, settings):
|
||||||
return command.script.startswith('man')
|
return command.script.strip().startswith('man ')
|
||||||
|
|
||||||
|
|
||||||
def get_new_command(command, settings):
|
def get_new_command(command, settings):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user