help: Only use open on macOS

Unfortunately on Debian "open" is a symlink to "openvt", and there's
no way from outside to tell.

This prevents fish from failing because no browser could be found.
This commit is contained in:
Fabian Boehm 2024-03-24 08:48:58 +01:00
parent c209e6b5fb
commit bdfa7341e7

View File

@ -57,11 +57,9 @@ 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
# We use the macOS open, but not otherwise.
# On Debian, there is an open command that's a symlink to openvt.
if uname | string match -q Darwin && 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