aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/help.fish
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-12-27 14:04:11 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-12-27 14:04:11 -0800
commit183aea5c9602b43f42a0ecdbc8a500a9d90d9c03 (patch)
tree972de64ae6994a3f39c9aaec65b84821f5a62fbe /share/functions/help.fish
parent97ddf9a4f3dca993dbd0453a8927ca8039754e39 (diff)
Teach help how to not drop fragments on OS X
Diffstat (limited to 'share/functions/help.fish')
-rw-r--r--share/functions/help.fish30
1 files changed, 15 insertions, 15 deletions
diff --git a/share/functions/help.fish b/share/functions/help.fish
index f9a3c820..d3d229c2 100644
--- a/share/functions/help.fish
+++ b/share/functions/help.fish
@@ -1,14 +1,5 @@
-
-#
-# help should use 'open' to find a suitable browser, but only
-# if there is a mime database _and_ DISPLAY is set, since the
-# browser will most likely be graphical. Since most systems which
-# have a mime databe also have the htmlview program, this is mostly a
-# theoretical problem.
-#
-
-function help --description "Show help for the fish shell"
-
+function help --description 'Show help for the fish shell'
+
# Declare variables to set correct scope
set -l fish_browser
set -l fish_browser_bg
@@ -67,10 +58,13 @@ function help --description "Show help for the fish shell"
if type xdg-open > /dev/null
set fish_browser xdg-open
end
-
- # On OS X, just use open
+
+
+ # On OS X, we go through osascript by default
if test (uname) = Darwin
- set fish_browser (which open)
+ if type osascript >/dev/null
+ set fish_browser osascript
+ end
end
end
@@ -120,7 +114,13 @@ function help --description "Show help for the fish shell"
set page_url http://fishshell.com/docs/$version_string/$fish_help_page
end
-
+ # OS X /usr/bin/open swallows fragments (anchors), so use osascript
+ # Eval is just a cheesy way of removing the hash escaping
+ if test "$fish_browser" = osascript
+ osascript -e 'open location "'(eval echo $page_url)'"'
+ return
+ end
+
if test $fish_browser_bg
switch $fish_browser