Skip to content

Commit 916a89b

Browse files
author
shaoying
committed
opt some
1 parent 475a818 commit 916a89b

File tree

4 files changed

+73
-26
lines changed

4 files changed

+73
-26
lines changed

core/core.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

33
require as code code/code.sh
4-
require as wiki wiki/wiki.sh
4+
# require as wiki wiki/wiki.sh

miss.sh

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,38 @@ export ctx_pid=${ctx_pid:=var/run/ice.pid}
55
export ctx_log=${ctx_log:=bin/boot.log}
66
export ctx_mod=${ctx_mod:="gdb,log,ssh,ctx"}
77

8+
require show.sh
9+
require help.sh
10+
811
ish_miss_ice_sh="bin/ice.sh"
912
ish_miss_ice_bin="bin/ice.bin"
1013
ish_miss_miss_sh="etc/miss.sh"
1114
ish_miss_main_go="src/main.go"
1215
ish_miss_init_shy="etc/init.shy"
1316
ish_miss_order_js="usr/publish/order.js"
1417

18+
ish_miss_help() {
19+
ish_help_show \
20+
usage -g "ish_miss_prepare $(ish_show -y repos)" \
21+
"" "下载代码" \
22+
"" "" \
23+
usage -y "ish_miss_restart" \
24+
"" "重启服务" \
25+
"" "" \
26+
usage -y "ish_miss_serve $(ish_show -y arg...)" \
27+
"" "重启服务" \
28+
"" "" \
29+
usage -g "ish_miss_start $(ish_show -y arg...)" \
30+
"" "启动服务" \
31+
"" "" \
32+
usage -r "ish_miss_stop" \
33+
"" "停止服务" \
34+
"" "" \
35+
usage -g "ish_miss_log" \
36+
"" "查看日志" \
37+
end
38+
}
39+
1540
ish_miss_create_path() {
1641
local target=$1 && [ -d ${target%/*} ] && return
1742
[ ${target%/*} != ${target} ] && mkdir -p ${target%/*} || return 0
@@ -47,15 +72,24 @@ ish_miss_prepare_install
4772
# ish_miss_prepare_intshell
4873
END
4974
}
50-
ish_miss_prepare_list() {
75+
ish_miss_prepare_help() {
5176
ish_help_show \
52-
index compile \
53-
index install \
54-
index volcanos \
55-
index icebergs \
56-
index intshell \
57-
index toolkits \
58-
index learning \
77+
usage -g "ish_miss_prepare_compile" \
78+
"" "生成源码" \
79+
usage -r "ish_miss_prepare_install" \
80+
"" "生成脚本" \
81+
"" "" \
82+
usage -g "ish_miss_prepare_volcanos" \
83+
"" "前端框架" \
84+
usage -y "ish_miss_prepare_icebergs" \
85+
"" "后端框架" \
86+
usage -r "ish_miss_prepare_intshell" \
87+
"" "终端框架" \
88+
"" "" \
89+
usage -g "ish_miss_prepare_toolkits" \
90+
"" "工具代码" \
91+
usage -g "ish_miss_prepare_learning" \
92+
"" "知识体系" \
5993
end
6094
}
6195
ish_miss_prepare_compile() {

plug.sh

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# $ ish_help_require
1919
# $ ish_help_ish
2020

21-
## 1.场景化
21+
## 1.场景化 # {
2222
ISH_CONF_ERR=${ISH_CONF_ERR:="/dev/stderr"}
2323
ISH_CONF_LOG=${ISH_CONF_LOG:="/dev/stderr"}
2424
ISH_CONF_LEVEL=${ISH_CONF_LEVEL:="require source debug test"}
@@ -43,8 +43,8 @@ ish_conf() {
4343
[ "$#" -gt "1" ] && eval "ISH_CONF_$1=$2"
4444
echo $(eval "echo \$ISH_CONF_$1")
4545
}
46-
47-
## 2.个性化
46+
# }
47+
## 2.个性化 # {
4848
ISH_USER_EMAIL=${ISH_USER_EMAIL:="[email protected]"}
4949
ISH_USER_COLOR=${ISH_USER_COLOR:="true"}
5050
ISH_USER_ERR_COUNT=0
@@ -54,36 +54,44 @@ ish_user() {
5454
ish_user_err_clear() {
5555
ISH_USER_ERR_COUNT=0
5656
}
57-
58-
## 3.可视化
57+
# }
58+
## 3.可视化 # {
5959
ISH_SHOW_COLOR_g="\e[32m"
60+
ISH_SHOW_COLOR_end="\e[0m"
6061
ish_show() {
6162
while [ "$#" -gt "0" ]; do case $1 in
6263
-username) echo -n "$(whoami)";;
6364
-hostname) echo -n "$(hostname)";;
6465
-date) echo -n "$(date +"%Y-%m-%d")";;
6566
-time) echo -n "$(date +"%Y-%m-%d %H:%M:%S")";;
6667
*)
67-
local k=$1 && [ "${k:0:1}" = "-" ] && shift
68-
local color=$(eval "echo \${ISH_SHOW_COLOR_${k:1}}" 2>/dev/null)
69-
[ "$ISH_USER_COLOR" = "true" ] && echo -ne "$color$1$ISH_SHOW_COLOR_end" || echo -n "$1"
68+
if local k=$1 && [ "${k:0:1}" = "-" ] ; then
69+
local color=$(eval "echo \${ISH_SHOW_COLOR_${k:1}}" 2>/dev/null)
70+
# [ "$ISH_USER_COLOR" = "true" ] && echo -ne "$color$1$ISH_SHOW_COLOR_end" || echo -n "$1"
71+
[ "$ISH_USER_COLOR" = "true" ] && echo -ne "$color\b"
72+
else
73+
echo -ne "$1$ISH_SHOW_COLOR_end"
74+
fi
7075
;;
7176
esac; [ "$#" -gt "0" ] && shift && echo -n " "; done; echo
7277
}
73-
## 4.结构化
74-
ish_list_parse='for _p in $(ish_get $prefix list); do
78+
# }
79+
## 4.结构化 # {
80+
ish_list_parse='for _p in $(ish_get $prefix list); do #{
7581
local _name=${_p%%=*} && local _value=${_p#$_name} && _value=${_value#=}
7682
eval "local $_name=$(ish_get $prefix $_name)"
7783
[ "$1" != "" ] && eval "$_name=$1"
7884
[ \"$(eval "echo \$$_name")\" = "" ] || eval "$_name=$_value"
7985
eval "${prefix}_$_name=$_value"
8086
shift
81-
done'
87+
done #}'
8288

8389
ish_list() {
8490
echo
8591
}
86-
## 5.变量
92+
# }
93+
94+
## 1.模块变量 # {
8795
ISH_CTX_ORDER=${ISH_CTX_ORDER:=0}
8896
ISH_CTX_MODULE=${ISH_CONF_PRE}_ctx
8997
ISH_CTX_SCRIPT=${ISH_CTX_MODULE}
@@ -92,7 +100,8 @@ ish_ctx() {
92100
echo
93101

94102
}
95-
## 6.日志
103+
# }
104+
## 2.模块日志 # {
96105
ISH_LOG_ERR=${ISH_CONF_ERR}
97106
ISH_LOG_INFO=${ISH_CONF_LOG}
98107
ish_log() {
@@ -118,8 +127,8 @@ ish_log_info() {
118127
ish_log_debug() { ish_log "debug" $@; }
119128
ish_log_source() { ish_log "source" $@; }
120129
ish_log_require() { ish_log "require" $@; }
121-
122-
## 7.模块加载
130+
# }
131+
## 3.模块加载 # {
123132
require_help() {
124133
echo -e "usage: $(_color green require \[as name\] file...)"
125134
echo -e " source script $(_color underline file) as $(_color underline name)"
@@ -272,8 +281,8 @@ _init() { _plug $ISH_CONF_INIT; }
272281
_exit() { _plug $ISH_CONF_EXIT; }
273282
trap _exit EXIT
274283
# _init;
275-
276-
## 8.模块接口
284+
# }
285+
## 4.模块接口 # {
277286
ish_help() {
278287
if [ "$1" = "" ]; then
279288
echo -e "usage: $(_color green ish mod/file_fun arg...)"
@@ -339,3 +348,5 @@ ish_arg() {
339348
name=$2 && shift 2
340349
[ "$1" != "" ] && value=$1
341350
}
351+
# }
352+

show.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh
22

3+
ISH_SHOW_COLOR_arg="\e[33;4m"
4+
35
ISH_SHOW_COLOR_r="\e[31m"
46
ISH_SHOW_COLOR_g="\e[32m"
57
ISH_SHOW_COLOR_y="\e[33m"

0 commit comments

Comments
 (0)