diff options
author | Gordon Tyler <gordon.tyler@software.dell.com> | 2016-02-09 10:08:57 -0500 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2016-02-12 23:53:17 +0100 |
commit | 89206d865419135593e66567fa2186034869d766 (patch) | |
tree | 02c0d73c4bd9082f3192d8e2458239395fa17a95 /share/functions | |
parent | a00e26b109083c2003a90d9cb6bd56bd4308392e (diff) |
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.
Diffstat (limited to 'share/functions')
-rw-r--r-- | share/functions/help.fish | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/share/functions/help.fish b/share/functions/help.fish index a04add53..23467a48 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -78,6 +78,15 @@ function help --description 'Show help for the fish shell' return 1 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] 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 # Help is installed, use it 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 # Go to the web. Only include one dot in the version string set -l version_string (echo $FISH_VERSION| cut -d . -f 1,2) |