forked from pystardust/ani-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI
More file actions
59 lines (50 loc) 路 1.31 KB
/
Copy pathUI
File metadata and controls
59 lines (50 loc) 路 1.31 KB
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
#!/bin/sh
UI_VERSION="1.0.0"
UI_NAME="classic"
ui_version_text() {
inf "UI theme: $UI_NAME"
inf "UI Version: $UI_VERSION"
}
retry () {
err "$*"
prompt
}
# display an error message to stderr (in red)
err () {
printf "\33[2K\r\033[1;31m%s\033[0m\n" "$*" >&2
}
# display an informational message (first argument in green, second in magenta)
inf () {
printf "\33[2K\r\033[1;35m%s \033[1;35m%s\033[0m\n" "$1" "$2"
}
progress() {
printf "\33[2K\r\033[1;34m%s\033[0m" "$1"
}
debug () {
printf "\n\033[1;32mReferrer :\033[0m %s\n\033[1;32mlinks >>\n\033[0m%s\n" "$1" "$2"
}
# prompts the user with message in $1-2 ($1 in blue, $2 in magenta) and saves the input to the variables in $REPLY and $REPLY2
prompt () {
[ -n "$*" ] && printf "\33[2K\r\033[1;35m%s\n" "$*"
printf "\033[1;35m> \033[0m"
read -r REPLY REPLY2
}
selection_menu() {
menu_line_parity=0
while read -r option line; do
if [ "$option" = "q" ]; then
printf "\033[1;31m(\033[1;31m%s\033[1;31m) \033[1;31m%s\033[0m\n" "$option" "$line"
else
if [ "$menu_line_parity" -eq 0 ]; then
printf "\033[1;33m(\033[1;33m%s\033[1;33m) \033[1;33m%s\033[0m\n" "$option" "$line"
menu_line_parity=1
else
printf "\033[1;36m(\033[1;36m%s\033[1;36m) \033[1;36m%s\033[0m\n" "$option" "$line"
menu_line_parity=0
fi
fi
done <<-EOF
$*
EOF
prompt
}