]> git.phdru.name Git - git-scripts.git/blob - git-open
Feat(submodules/remove): Add option `-c`
[git-scripts.git] / git-open
1 #! /bin/sh
2
3 if [ $# -ne 1 ]; then
4    echo "Usage: git open url_key" >&2
5    exit 1
6 else
7    url_key="$1"
8 fi
9
10 if [ -z "$url_key" ]; then
11    echo "Usage: git open url_key" >&2
12    exit 1
13 fi
14
15 browser_section="`git config --get web.browser`"
16 browser_cmd="`git config --get browser.\"$browser_section\".cmd`"
17 if [ -z "$browser_cmd" ]; then
18    browser_cmd="webbrowser -n"
19 fi
20
21 exec $browser_cmd "`git config --get $url_key | sed 's!^git@\([-A-Za-z0-9._]\+\):!https://\1/!'`"