-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathcircleci.sh
75 lines (61 loc) · 1.86 KB
/
circleci.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
_patch_help() {
$@ --help 2>&1 | \
_patch_help_strip_ansi | \
sed \
-e 's/[┃|┗|━|┏|┓|┛]//g' \
-e 's/^ //' \
-e 's/\s\+$//' \
}
_patch_table() {
table="$( \
_patch_table_detect_value_type \
| \
_patch_table_edit_arguments \
'vcs-type;[github|bitbucket]' \
)"
if [[ "$*" == "circleci config" ]]; then
echo "$table" | \
_patch_table_edit_commands \
'validate(validate, check)' \
elif [[ "$*" == "circleci orb"* ]]; then
table="$( \
echo "$table" | \
_patch_table_edit_arguments \
'category-name;[`_choice_orb_category`]' \
)"
if [[ "$*" == "circleci orb diff" ]]; then
echo "$table" | \
_patch_table_edit_options \
'--color;[always|auto|never]' \
elif [[ "$*" == "circleci orb publish" ]]; then
echo "$table" | \
_patch_table_edit_commands \
'publish(increment, inc)' \
else
echo "$table"
fi
elif [[ "$*" == "circleci policy test" ]]; then
echo "$table" | \
_patch_table_edit_options \
'--format;[json|junit]' \
elif [[ "$*" == "circleci runner instance" ]]; then
echo "$table" | \
_patch_table_edit_commands \
'list(list, ls)' \
elif [[ "$*" == "circleci runner resource-class" ]]; then
echo "$table" | \
_patch_table_edit_commands \
'delete(delete, rm)' \
'list(list, ls)' \
elif [[ "$*" == "circleci runner token" ]]; then
echo "$table" | \
_patch_table_edit_commands \
'delete(delete, rm)' \
'list(list, ls)' \
else
echo "$table"
fi
}
_choice_orb_category() {
circleci orb list-categories
}