From 3ae01ac65d541e9a34b55abaecfb071d1906fb15 Mon Sep 17 00:00:00 2001 From: mcarton Date: Fri, 31 Jul 2015 21:41:07 +0200 Subject: [PATCH] Adapt the `man` rule to #324 --- tests/rules/test_man.py | 2 +- thefuck/rules/man.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/rules/test_man.py b/tests/rules/test_man.py index 883d736..7be5468 100644 --- a/tests/rules/test_man.py +++ b/tests/rules/test_man.py @@ -23,7 +23,7 @@ def test_not_match(command): @pytest.mark.parametrize('command, new_command', [ - (Command('man read'), 'man 3 read'), + (Command('man read'), ['man 3 read', 'man 2 read']), (Command('man 2 read'), 'man 3 read'), (Command('man 3 read'), 'man 2 read'), (Command('man -s2 read'), 'man -s3 read'), diff --git a/thefuck/rules/man.py b/thefuck/rules/man.py index 0b15c5f..869350c 100644 --- a/thefuck/rules/man.py +++ b/thefuck/rules/man.py @@ -8,6 +8,10 @@ def get_new_command(command, settings): if '2' in command.script: return command.script.replace("2", "3") - split_cmd = command.script.split() - split_cmd.insert(1, ' 3 ') - return "".join(split_cmd) + split_cmd2 = command.script.split() + split_cmd3 = split_cmd2[:] + + split_cmd2.insert(1, ' 2 ') + split_cmd3.insert(1, ' 3 ') + + return ["".join(split_cmd3), "".join(split_cmd2)]