1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-31 10:11:14 +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:
Vladimir Iakovlev 2015-05-21 15:42:26 +03:00
commit 675317b247
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import pytest
from thefuck.rules.man import match, get_new_command
from tests.utils import Command
@pytest.mark.parametrize('command', [
Command('man read'),
Command('man 2 read'),
@ -14,6 +15,13 @@ def test_match(command):
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', [
(Command('man read'), 'man 3 read'),
(Command('man 2 read'), 'man 3 read'),

View File

@ -1,5 +1,5 @@
def match(command, settings):
return command.script.startswith('man')
return command.script.strip().startswith('man ')
def get_new_command(command, settings):