#! /bin/sh
-if [ -z "$1" ]; then
- branch="`git rev-parse --abbrev-ref HEAD`"
- remote="`git config --get branch.$branch.remote`"
-elif [ -n "$2" ]; then
- echo "Usage: git open [remote_name]" >&2
+if [ -z "$1" -o -n "$2" ]; then
+ echo "Usage: git open url_key" >&2
exit 1
else
- remote="$1"
+ url_key="$1"
fi
-if [ -z "$remote" ]; then
- echo "Cannot find remote for branch $branch" >&2
- echo "Usage: git open [remote_name]" >&2
+if [ -z "$url_key" ]; then
+ echo "Usage: git open url_key" >&2
exit 1
fi
browser_cmd="webbrowser -n"
fi
-exec $browser_cmd "`git config --get remote.$remote.url`"
+exec $browser_cmd "`git config --get $url_key`"
--- /dev/null
+#! /bin/sh
+
+if [ -z "$1" ]; then
+ branch="`git rev-parse --abbrev-ref HEAD`"
+ remote="`git config --get branch.$branch.remote`"
+elif [ -n "$2" ]; then
+ echo "Usage: git open-remote [remote_name]" >&2
+ exit 1
+else
+ remote="$1"
+fi
+
+if [ -z "$remote" ]; then
+ echo "Cannot find remote for branch $branch" >&2
+ echo "Usage: git open-remote [remote_name]" >&2
+ exit 1
+fi
+
+exec git-open remote.$remote.url