diff options
author | 2012-12-27 13:39:43 -0800 | |
---|---|---|
committer | 2012-12-27 13:39:43 -0800 | |
commit | 97ddf9a4f3dca993dbd0453a8927ca8039754e39 (patch) | |
tree | 4592b21ef4793fa18a26ecd2d9b3bcd399b58523 /share | |
parent | 489366290a5e5dfe96c23c97a53cf00d37558c25 (diff) |
Teach help how to go to the web if documentation is not installed
Diffstat (limited to 'share')
-rw-r--r-- | share/functions/help.fish | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/share/functions/help.fish b/share/functions/help.fish index 35f136fb..f9a3c820 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -102,14 +102,24 @@ function help --description "Show help for the fish shell" # the annoying useless "builtin" man page bash # installs on OS X set -l man_arg "$__fish_datadir/man/man1/$fish_help_item.1" - if test ! -f "$man_arg" - set man_arg $fish_help_item + if test -f "$man_arg" + man $man_arg + return end - man $man_arg - return end set fish_help_page "index.html" end + + set -l page_url + if test -f $__fish_help_dir/index.html + # Help is installed, use it + set page_url file://$__fish_help_dir/$fish_help_page + 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) + set page_url http://fishshell.com/docs/$version_string/$fish_help_page + end + if test $fish_browser_bg @@ -122,8 +132,8 @@ function help --description "Show help for the fish shell" end - eval "$fish_browser file://$__fish_help_dir/$fish_help_page &" + eval "$fish_browser $page_url &" else - eval $fish_browser file://$__fish_help_dir/$fish_help_page + eval $fish_browser $page_url end end |