mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 17:31:14 -03:00
help: Show online URL in case showing it locally doesn't work.
See #10668.
This commit is contained in:
@@ -182,6 +182,9 @@ function help --description 'Show help for the fish shell'
|
|||||||
string match -q '*garcon-url-handler*' $fish_browser[1]
|
string match -q '*garcon-url-handler*' $fish_browser[1]
|
||||||
and set -l chromeos_linux_garcon
|
and set -l chromeos_linux_garcon
|
||||||
|
|
||||||
|
# Generate the online URL, with one dot in the version string (major.minor)
|
||||||
|
set -l version_string (string split . -f 1,2 -- $version | string join .)
|
||||||
|
set -l ext_url https://fishshell.com/docs/$version_string/$fish_help_page
|
||||||
set -l page_url
|
set -l page_url
|
||||||
if test -f $__fish_help_dir/index.html; and not set -lq chromeos_linux_garcon
|
if test -f $__fish_help_dir/index.html; and not set -lq chromeos_linux_garcon
|
||||||
# Help is installed, use it
|
# Help is installed, use it
|
||||||
@@ -198,9 +201,7 @@ function help --description 'Show help for the fish shell'
|
|||||||
set page_url file://(wslpath -w $__fish_help_dir)/$fish_help_page
|
set page_url file://(wslpath -w $__fish_help_dir)/$fish_help_page
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Go to the web. Only include one dot in the version string
|
set page_url $ext_url
|
||||||
set -l version_string (string split . -f 1,2 -- $version | string join .)
|
|
||||||
set page_url https://fishshell.com/docs/$version_string/$fish_help_page
|
|
||||||
# We don't need a trampoline for a remote URL.
|
# We don't need a trampoline for a remote URL.
|
||||||
set need_trampoline
|
set need_trampoline
|
||||||
end
|
end
|
||||||
@@ -241,4 +242,8 @@ function help --description 'Show help for the fish shell'
|
|||||||
else
|
else
|
||||||
$fish_browser $page_url
|
$fish_browser $page_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Show the online URL anyway in case we did not manage to open something successfully.
|
||||||
|
# (we can't check because we need to background it)
|
||||||
|
printf (_ 'help: If no help could be displayed, go to %s to view the documentaiton online.\n') $ext_url
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user