web--browse: Add support for xdg-open
xdg-open is a tool similar to git-web--browse. It opens a file or URL in the user's preferred application. It could probably be made default at least on Linux with a graphical environment. Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Rüdiger Sonderfeld committed
Oct 26, 2013 at 19:43 UTC
6ca0f80b6c4d17843a9773d5fd909395f786731d
2 files changed
+4
-3
Documentation/git-web--browse.txt
+1
@@ -35,6 +35,7 @@ The following browsers (or commands) are currently supported:
35
* open (this is the default under Mac OS X GUI)
36
* start (this is the default under MinGW)
37
* cygstart (this is the default under Cygwin)
38
+* xdg-open
39
40
Custom commands may also be specified.
41
git-web--browse.sh
+3
-3
@@ -34,7 +34,7 @@ valid_tool() {
34
firefox | iceweasel | seamonkey | iceape | \
35
chrome | google-chrome | chromium | chromium-browser | \
36
konqueror | opera | w3m | elinks | links | lynx | dillo | open | \
37
- start | cygstart)
37
+ start | cygstart | xdg-open)
38
;; # happy
39
*)
40
valid_custom_tool "$1" || return 1
@@ -112,7 +112,7 @@ fi
112
113
if test -z "$browser" ; then
114
if test -n "$DISPLAY"; then
115
- browser_candidates="firefox iceweasel google-chrome chrome chromium chromium-browser konqueror opera seamonkey iceape w3m elinks links lynx dillo"
115
+ browser_candidates="firefox iceweasel google-chrome chrome chromium chromium-browser konqueror opera seamonkey iceape w3m elinks links lynx dillo xdg-open"
116
if test "$KDE_FULL_SESSION" = "true"; then
117
browser_candidates="konqueror $browser_candidates"
118
fi
@@ -179,7 +179,7 @@ konqueror)
179
;;
180
esac
181
;;
182
-w3m|elinks|links|lynx|open|cygstart)
182
+w3m|elinks|links|lynx|open|cygstart|xdg-open)
183
"$browser_path" "$@"
184
;;
185
start)