-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.sh
executable file
·66 lines (52 loc) · 1.4 KB
/
main.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
#!/usr/bin/env bash
main(){
local arg
# get VARIABLE
[[ $1 = get ]] && {
sed -n 's/^'"$2"'\b[[:space:]]*//p' \
"$MONDO_DIR/themes/.current"
exit
}
# global variables
__action=""
__dateformat='+%Y-%m-%d'
__wt="" # theme in memory
__wt_name="" # name of theme in memory
# --new|-n NAME
if [[ ${__o[new]} ]]; then
__action=newtheme
arg="${__o[new]}"
# --template|-t FILE|[NAME FILE]
elif [[ ${__o[template]} ]]; then
__action=newgenerator
arg="${__o[template]}"
# [--force|-f] --generate|-g THEME|all
elif [[ ${__o[generate]} ]]; then
__action=generatetheme
arg="${__o[generate]}"
# --apply|-a THEME
elif [[ ${__o[apply]} ]]; then
__action=applytheme
arg="${__o[apply]}"
# --list|-l theme|var|icon|gtk|cursor
elif [[ ${__o[list]} ]]; then
__action=mondolist
arg="${__o[list]}"
# --call|-c FUNCTION [THEME]
elif [[ ${__o[call]} ]]; then
__action=callfunc
arg="${__o[call]}"
# [--force|-f] --update|-u GENERATOR [THEME]
elif [[ ${__o[update]} ]]; then
__action=updategenerator
arg="${__o[update]}"
else
___printhelp
exit
fi
"$__action" "${arg:-}"
}
___source="$(readlink -f "${BASH_SOURCE[0]}")" #bashbud
___dir="${___source%/*}" #bashbud
source "$___dir/init.sh" #bashbud
main "${@}" #bashbud