-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathbasher-install
executable file
·62 lines (51 loc) · 987 Bytes
/
basher-install
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
57
58
59
60
61
62
#!/usr/bin/env bash
#
# Summary: Installs a package from github (or a custom site)
#
# Usage: basher install [--ssh] [site]/<package>[@ref]
set -e
use_ssh="false"
case $1 in
--ssh)
use_ssh="true"
shift
;;
esac
if [ "$#" -ne 1 ]; then
basher-help install
exit 1
fi
if [[ "$1" = */*/* ]]; then
IFS=/ read -r site user name <<< "$1"
package="${user}/${name}"
else
package="$1"
site="github.com"
fi
if [ -z "$package" ]; then
basher-help install
exit 1
fi
IFS=/ read -r user name <<< "$package"
if [ -z "$user" ]; then
basher-help install
exit 1
fi
if [ -z "$name" ]; then
basher-help install
exit 1
fi
if [[ "$package" = */*@* ]]; then
IFS=@ read -r package ref <<< "$package"
else
ref=""
fi
if [ -z "$ref" ]; then
basher-_clone "$use_ssh" "$site" "$package"
else
basher-_clone "$use_ssh" "$site" "$package" "$ref"
fi
basher-_deps "$package"
basher-_link-bins "$package"
basher-_link-man "$package"
basher-_link-completions "$package"