-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhgit
More file actions
35 lines (28 loc) · 1018 Bytes
/
hgit
File metadata and controls
35 lines (28 loc) · 1018 Bytes
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
___x_cmd_get_setupscript(){
___X_CMD_ROOT=$HOME/.x-cmd.root
mkdir -p "$___X_CMD_ROOT/v"
local ___X_CMD_DISTRIBUTION="${1:?Provide version}"
case "$___X_CMD_DISTRIBUTION" in
*/*)
___X_CMD___GET_REPO="${___X_CMD_DISTRIBUTION%/*}"
___X_CMD___GET_BRANCH="${___X_CMD_DISTRIBUTION##*/}"
;;
*)
___X_CMD___GET_REPO="${___X_CMD_DISTRIBUTION}"
___X_CMD___GET_BRANCH=main
;;
esac
___X_CMD_VERSION="$___X_CMD_DISTRIBUTION"
(
cd "$___X_CMD_ROOT/v"
[ ! -d "$___X_CMD_VERSION" ] || {
printf "%s" "Already exists: $PWD/$___X_CMD_VERSION"
return 1
}
git clone "https://github.com/x-cmd/$___X_CMD___GET_REPO.git" -b "$___X_CMD___GET_BRANCH" "$___X_CMD_VERSION" || exit 1
)
___X_CMD_ROOT_V_VERSION="$___X_CMD_ROOT/v/$___X_CMD_VERSION"
. "$___X_CMD_ROOT_V_VERSION/X"
x boot init
}
___x_cmd_get_setupscript "${REPO:-x-cmd/main}"