-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbashid-builder.sh
executable file
·69 lines (61 loc) · 1.6 KB
/
bashid-builder.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
#!/bin/bash
# BashID Sites Manager
# init
for file in bashid_modules/*; do
. "bashid_modules/${file##*/}"
done
banner
while [ "$1" != "" ]; do
argv=`echo $1 | awk -F= '{print $1}'`
val=`echo $2 | sed 's/^[^=]*=//g'`
case $argv in
-h | --help)
echo "help me"
exit
;;
--create)
check_pkg
hugo new "blog/${val// /-}.md" > /dev/null 2>&1
vi "content/blog/${val// /-}.md"
;;
--deploy)
check_pkg
[[ ${val,,} == "staging" || ${val} == 0 ]] && {
deploy 0
};
[[ ${val,,} == "production" || ${val} == 1 ]] && {
deploy 1
};
;;
*)
exit 1
;;
esac
shift
done
[[ $# -eq 0 ]] && { check_pkg
declare -a options=("Create post" "Deploy Sites");
generateDialog "options" "Choose an option" "${options[@]}"
read -p ">> " choice
clear
case $choice in
1 )
while [[ $title == '' ]]; do
read -p ">> title: " title
done
hugo new "blog/${title// /-}.md" > /dev/null 2>&1
vi "content/blog/${title// /-}.md"
;;
2 )
declare -a instructions=("Staging" "Production");
generateDialog "instructions" "Deploying mode" "${instructions[@]}"
read -p ">> " mode
[[ $mode == 1 ]] && {
deploy 0
};
[[ $mode == 2 ]] && {
deploy 1
};
;;
esac
};