functions/help: Prefer xdg-open/cygstart over open

Some systems like Debian have "open" as a symlink to "openvt" (for... historical
reasons).

See #5756.

[ci skip]
This commit is contained in:
Fabian Homborg 2019-03-27 09:03:17 +01:00
parent 54156845e4
commit 248200520e

View file

@ -54,6 +54,16 @@ function help --description 'Show help for the fish shell'
end
end
# If we have an open _command_ we use it - otherwise it's our function,
# which might not have a backend to use.
# Note that we prefer xdg-open, because this open might also be a symlink to "openvt"
# like it is on Debian.
if command -sq open
set fish_browser open
# The open command needs a trampoline because the macOS version can't handle #-fragments.
set need_trampoline 1
end
# If the OS appears to be Windows (graphical), try to use cygstart
if type -q cygstart
set fish_browser cygstart
@ -62,14 +72,6 @@ function help --description 'Show help for the fish shell'
else if type -q xdg-open; and set -q -x DISPLAY
set fish_browser xdg-open
end
# If we have an open _command_ we use it - otherwise it's our function,
# which might not have a backend to use.
if command -sq open
set fish_browser open
# The open command needs a trampoline because the macOS version can't handle #-fragments.
set need_trampoline 1
end
end
end