-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-flux-hf
65 lines (52 loc) · 1.39 KB
/
git-flux-hf
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
63
64
65
#!/usr/bin/env bash
cmd_usage_default() {
printf "%s" "start|finish <name> [<tag>] [-h]"
}
cmd_usage_start() {
printf "%s" "start <name> <tag> [-h]"
}
cmd_usage_finish() {
printf "%s" "finish <name> [-h]"
}
cmd_long_usage_default() {
printf "%s" "\
$(f_heading "hf" | f_fg_red)
handle lifecycle of hot-fixes.
$(f_subheading "available actions")
$(cmd_long_usage_start)
$(cmd_long_usage_finish)
"
}
cmd_long_usage_start() {
printf "%s" "\
$(f_code_definition \
"$(cmd_usage_start)" \
"start a hot-fix; create a local branch and push it to the remote.
the branch name will be composed of the pre-configured hot-fix prefix and the passed $(f_code "name").
it is advised that $(f_code "name") will be the version this hot-fix refers to, e.g. '1.0.0'.
the passed $(f_code "tag") will be used as the branch base.")
"
}
cmd_long_usage_finish() {
printf "%s" "\
$(f_code_definition \
"$(cmd_usage_finish)" \
"finish an existing hot-fix; delete its local and remote branches, for good.")
"
}
cmd_start() {
local name
local tag
require_args "$1" "$2"
name="$1"
tag="$2"
io_log; create_branch_from_tag "$(git_config_get "prefix.hf")$name" "$tag"
io_log; io_log_ok "hot-fix '$name' is started. good luck!"; io_log
}
cmd_finish() {
local name
require_args "$1"
name="$1"
io_log; destroy_branch_from_tag "$(git_config_get "prefix.hf")$name"
io_log; io_log_ok "hot-fix '$name' is finished. goodbye!"; io_log
}