help: Print external URL if no browser was found

This is nicer when you use fish over ssh, and that system does not
have a browser. But the system where your terminal is has one, and so
now you can just click the link.
This commit is contained in:
Fabian Boehm 2024-11-02 21:28:17 +01:00
parent 018659bf66
commit 0979b9a98b

View file

@ -95,16 +95,11 @@ function help --description 'Show help for the fish shell'
end
end
if not set -q fish_browser[1]
printf (_ '%s: Could not find a web browser.\n') help >&2
printf (_ 'Please try `BROWSER=some_browser help`, `man fish-doc`, or `man fish-tutorial`.\n\n') >&2
return 1
end
# In Cygwin, start the user-specified browser using cygstart,
# only if a Windows browser is to be used.
if type -q cygstart
if test $fish_browser != cygstart
if test "$fish_browser" != cygstart
and set -q fish_browser[1]
and not command -sq $fish_browser[1]
# Escaped quotes are necessary to work with spaces in the path
# when the command is finally eval'd.
@ -206,6 +201,13 @@ function help --description 'Show help for the fish shell'
set need_trampoline
end
if not set -q fish_browser[1]
printf (_ '%s: Could not find a web browser.\n') help >&2
printf (_ 'Please try `BROWSER=some_browser help`, `man fish-doc`, or `man fish-tutorial`.\n\n') >&2
printf (_ 'Or open %s in your browser of choice.\n') $ext_url >&2
return 1
end
if set -q need_trampoline[1]
# If string replace doesn't replace anything, we don't actually need a
# trampoline (they're only needed if there's a fragment in the path)