-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog.sh
executable file
·72 lines (67 loc) · 2.53 KB
/
blog.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
#!/bin/bash
cd ~/Documents/.QuickScript
source msg.sh
start() {
cd Blog
while :
do
if [ "$p1" == "" ]; then
clear
echo "********************** LeetCode Mode *********************"
printf "命令\n"
printf " \033[32m %s \033[0m %s \t\t\t %s \n" "c " "(clean)" " 执行 hexo clean"
printf " \033[32m %s \033[0m %s \t\t %s \n" "s " "(server)" " 执行 hexo server"
printf " \033[32m %s \033[0m %s \t\t %s \n" "g " "(generate)" " 执行 hexo generate"
printf " \033[32m %s \033[0m %s \t\t %s \n" "d " "(deploy)" " 执行 hexo deploy"
printf " \033[32m %s \033[0m %s \t\t %s \n" "cs " "(clean, server)" " 执行 c s 组合"
printf " \033[32m %s \033[0m %s \t %s \n" "cg " "(clean generate)" " 执行 c g 组合"
printf " \033[32m %s \033[0m %s \t\t %s \n" "cgd" "(c, g, d)" " 执行 c g d 组合,然后提交代码"
printf " \033[32m %s \033[0m %s \t\t %s \n" "ot " "(open typora)" " 在 blog 目录打开 typora "
printf " \033[32m %s \033[0m %s \t\t %s \n" "oc " "(open code)" " 在 BlogCode 目录打开 vscode "
printf " \033[32m %s \033[0m %s \t\t\t %s \n" "q " "(quit)" " 退出当前脚本 "
echo "**********************************************************"
read -p "请输入指令: " p1
fi
case $p1 in
"c") execute hexo clean ;;
"s") execute hexo server -o;;
"g") execute hexo generate ;;
"d") execute hexo deploy;;
"cs")
execute hexo clean
execute hexo server -o
;;
"cg")
execute hexo clean
execute hexo generate
;;
"cgd")
execute hexo clean
execute hexo generate
execute hexo deploy
git add .
git commit -m "update blog"
git push origin master
cd ../BlogCode
git add .
git commit -m "update code"
git push origin master
cd ../Blog
;;
"ot") execute open -a typora source ;;
"oc") code ../BlogCode ;;
"q")
# 回到根目录
cd ..
return
;;
*)
execute $p1 || on_fail "命令有误..."
;;
esac
on_wait
p1="" && p2=""
done
}
p1=$1
start