mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 13:08:49 +00:00
Fix user browser for help in Cygwin
Fixes the invocation of a user-specified browser by the `help` command on Cygwin. - Use `cygstart` to launch the browser with escaped quotes to avoid problems with spaces in the path to the browser, (e.g. Program Files). - Use `cygpath` to convert the base help dir to a Windows path before constructing the fie URL to pass to the browser.
This commit is contained in:
parent
a00e26b109
commit
89206d8654
1 changed files with 14 additions and 0 deletions
|
@ -78,6 +78,15 @@ function help --description 'Show help for the fish shell'
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# In Cygwin, start the user-specified browser using cygstart
|
||||||
|
if type -q cygstart
|
||||||
|
if test $fish_browser != "cygstart"
|
||||||
|
# Escaped quotes are necessary to work with spaces in the path
|
||||||
|
# when the command is finally eval'd.
|
||||||
|
set fish_browser cygstart \"$fish_browser\"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
set -l fish_help_item $argv[1]
|
set -l fish_help_item $argv[1]
|
||||||
|
|
||||||
switch "$fish_help_item"
|
switch "$fish_help_item"
|
||||||
|
@ -109,6 +118,11 @@ function help --description 'Show help for the fish shell'
|
||||||
if test -f $__fish_help_dir/index.html
|
if test -f $__fish_help_dir/index.html
|
||||||
# Help is installed, use it
|
# Help is installed, use it
|
||||||
set page_url file://$__fish_help_dir/$fish_help_page
|
set page_url file://$__fish_help_dir/$fish_help_page
|
||||||
|
|
||||||
|
# In Cygwin, we need to convert the base help dir to a Windows path before converting it to a file URL
|
||||||
|
if type -q cygpath
|
||||||
|
set page_url file://(cygpath -m $__fish_help_dir)/$fish_help_page
|
||||||
|
end
|
||||||
else
|
else
|
||||||
# Go to the web. Only include one dot in the version string
|
# Go to the web. Only include one dot in the version string
|
||||||
set -l version_string (echo $FISH_VERSION| cut -d . -f 1,2)
|
set -l version_string (echo $FISH_VERSION| cut -d . -f 1,2)
|
||||||
|
|
Loading…
Reference in a new issue