mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 15:37:59 +08:00
__fish_man_page: Try man before
This is really just `less` being precious and `man` being unspecified. Fixes #7863.
This commit is contained in:
parent
61b94fe093
commit
1705bd1440
|
@ -18,12 +18,24 @@ function __fish_man_page
|
|||
# Try "man first-second" and fall back to "man first" if that doesn't work out.
|
||||
set -l maincmd (basename $args[1])
|
||||
if set -q args[2]
|
||||
man "$maincmd-$args[2]" 2>/dev/null
|
||||
or man "$maincmd" 2>/dev/null
|
||||
or printf \a
|
||||
# HACK: If stderr is not attached to a terminal `less` (the default pager)
|
||||
# wouldn't use the alternate screen.
|
||||
# But since we don't know what pager it is, and because `man` is totally underspecified,
|
||||
# the best we can do is to *try* the man page, and assume that `man` will return false if it fails.
|
||||
# See #7863.
|
||||
if man "$maincmd-$args[2]" &>/dev/null
|
||||
man "$maincmd-$args[2]"
|
||||
else if man "$maincmd" &>/dev/null
|
||||
man "$maincmd"
|
||||
else
|
||||
printf \a
|
||||
end
|
||||
else
|
||||
man "$maincmd" 2>/dev/null
|
||||
or printf \a
|
||||
if man "$maincmd" &>/dev/null
|
||||
man "$maincmd"
|
||||
else
|
||||
printf \a
|
||||
end
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
|
|
Loading…
Reference in New Issue
Block a user