1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-13 22:28:33 +00:00

For man foo, try foo --help before man 3 foo

`man` without a section searches all sections, so having `foo --help`
suggested first makes more sense than adding a specific section. See
https://github.com/nvbn/thefuck/pull/562#issuecomment-251142710

However, in cases where multiple sections have man pages for `foo`,
running `man foo` could bring up the "wrong" section of man pages.
`man read` is an example of this, but that should probably be handled in
a way that still suggests `foo --help` first when there are *no* man
pages for `foo` in any section.

Closes https://github.com/nvbn/thefuck/issues/546
This commit is contained in:
Joseph Frazier 2016-10-03 11:54:29 -04:00
parent 5dbbb3b1ed
commit 8bd6c5da67
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ def test_not_match(command):
@pytest.mark.parametrize('command, new_command', [
(Command('man read'), ['man 3 read', 'man 2 read', 'read --help']),
(Command('man read'), ['read --help', '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'),

View File

@ -21,7 +21,7 @@ def get_new_command(command):
last_arg = command.script_parts[-1]
return [
last_arg + ' --help',
"".join(split_cmd3),
"".join(split_cmd2),
last_arg + ' --help',
]