From 5dbbb3b1ed9b3eb7ac7ec3eb155f7ded3b6f348e Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Mon, 3 Oct 2016 03:54:13 -0400 Subject: [PATCH] Add `... --help` to `man` suggestions This is along the lines of what @waldyrious suggested in https://github.com/nvbn/thefuck/issues/546, but it just adds a new suggestion rather than replacing the other ones. --- tests/rules/test_man.py | 2 +- thefuck/rules/man.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/rules/test_man.py b/tests/rules/test_man.py index 01eab173..1c9095ca 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', 'man 2 read']), + (Command('man read'), ['man 3 read', 'man 2 read', 'read --help']), (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 ead1361b..6fcea5af 100644 --- a/thefuck/rules/man.py +++ b/thefuck/rules/man.py @@ -18,4 +18,10 @@ def get_new_command(command): split_cmd2.insert(1, ' 2 ') split_cmd3.insert(1, ' 3 ') - return ["".join(split_cmd3), "".join(split_cmd2)] + last_arg = command.script_parts[-1] + + return [ + "".join(split_cmd3), + "".join(split_cmd2), + last_arg + ' --help', + ]