-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgithub-plugin-install.sh
executable file
·56 lines (40 loc) · 1.04 KB
/
github-plugin-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
USAGE="Install or update vim plugin from github
see http://github.com/tpope/vim-pathogen
USAGE:
$0 <github name> [<bundle name> [<github branch>]]
github name - without git suffix
bundle name - default to basename github_name
github branch - default to master
EXAMPLE:
bash $0 kchmck/vim-coffee-script
bash $0 kchmck/vim-coffee-script vim-coffee-script
bash $0 kchmck/vim-coffee-script vim-coffee-script master
"
usage() {
echo "$USAGE"
exit 2
}
github_name="$1"
bundle_name=${2:-$(basename "$github_name")}
github_branch=${3:-master}
test -z "$1" -o "$1" = '-h' && usage
message="bundle/$bundle_name from github $github_name $github_branch
from https://github.com/$github_name
Install or update
bash github-plugin-install.sh $github_name $bundle_name $github_branch
"
if test -d bundle/$bundle_name
then
cmd=pull
action=Update
else
cmd=add
action=Add
fi
echo "$action $github_name"
git subtree $cmd \
--prefix=bundle/$bundle_name \
--squash \
-m "$action $message" \
https://github.com/$github_name.git $github_branch