diff --git a/base/cli/cli.go b/base/cli/cli.go index ce964257..e7ed351e 100644 --- a/base/cli/cli.go +++ b/base/cli/cli.go @@ -1,11 +1,14 @@ package cli import ( + "bytes" + ice "github.com/shylinux/icebergs" "github.com/shylinux/icebergs/base/ctx" "github.com/shylinux/icebergs/base/mdb" kit "github.com/shylinux/toolkits" + "io/ioutil" "os" "os/user" "path" @@ -94,7 +97,36 @@ var Index = &ice.Context{Name: "cli", Help: "命令模块", RUNTIME: {Name: "runtime name auto", Help: "运行环境", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { switch kit.Select("", arg, 0) { + case "procinfo": + m.Split(m.Cmdx(SYSTEM, "ps"), "", " ", "\n") + case "hostinfo": + if f, e := os.Open("/proc/cpuinfo"); e == nil { + defer f.Close() + if b, e := ioutil.ReadAll(f); e == nil { + m.Push("nCPU", bytes.Count(b, []byte("processor"))) + } + } + if f, e := os.Open("/proc/meminfo"); e == nil { + defer f.Close() + if b, e := ioutil.ReadAll(f); e == nil { + for i, ls := range strings.Split(string(b), "\n") { + vs := kit.Split(ls, ": ") + m.Push(strings.TrimSpace(vs[0]), kit.FmtSize(kit.Int64(strings.TrimSpace(vs[1]))*1024)) + if i > 1 { + break + } + } + } + } + m.Push("uptime", kit.Split(m.Cmdx(SYSTEM, "uptime"), ",")[0]) + case "diskinfo": + m.Split(m.Cmdx(SYSTEM, "df", "-h"), "", " ", "\n") + case "ifconfig": + m.Cmdy("tcp.ip") + case "userinfo": + m.Split(m.Cmdx(SYSTEM, "who"), "user term time", " ", "\n") + case "hostname": m.Conf(RUNTIME, "boot.hostname", arg[1]) HostName = arg[1] diff --git a/core/code/sh.go b/core/code/sh.go index 4065c12a..b79c6159 100644 --- a/core/code/sh.go +++ b/core/code/sh.go @@ -39,6 +39,10 @@ func init() { mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(cli.SYSTEM, path.Join(arg[2], arg[1])) }}, + + "man": {Hand: func(m *ice.Message, arg ...string) { + m.Echo(_c_help(m, arg[0], arg[1])) + }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}}, }, Configs: map[string]*ice.Config{ diff --git a/core/team/team.go b/core/team/team.go index 2116996c..9e1cc14c 100644 --- a/core/team/team.go +++ b/core/team/team.go @@ -359,7 +359,7 @@ var Index = &ice.Context{Name: "team", Help: "团队中心", }) } }}, - PLAN: {Name: "plan scale:select=day|week|month|year|long begin_time=@date auto 添加:button", Help: "计划", Meta: kit.Dict( + PLAN: {Name: "plan scale:select=day|week|month|year|long begin_time=@date auto 添加:button 导出:button 导入:button", Help: "计划", Meta: kit.Dict( "添加", _task_inputs, "display", "/plugin/local/team/plan.js", "detail", []string{StatusPrepare, StatusProcess, StatusCancel, StatusFinish}, "style", "plan", @@ -375,10 +375,10 @@ var Index = &ice.Context{Name: "team", Help: "团队中心", _task_delete(m, m.Option(kit.MDB_ZONE), m.Option(kit.MDB_ID)) }}, mdb.EXPORT: {Name: "export file", Help: "导出", Hand: func(m *ice.Message, arg ...string) { - _task_export(m, kit.Select(path.Join(EXPORT, m.Option(ice.MSG_DOMAIN), "list.csv"), arg, 0)) + _task_export(m, kit.Select(path.Join(EXPORT, m.Option(ice.MSG_DOMAIN), "list.csv"))) }}, mdb.IMPORT: {Name: "import file", Help: "导入", Hand: func(m *ice.Message, arg ...string) { - _task_import(m, kit.Select(path.Join(EXPORT, m.Option(ice.MSG_DOMAIN), "list.csv"), arg, 0)) + _task_import(m, kit.Select(path.Join(EXPORT, m.Option(ice.MSG_DOMAIN), "list.csv"))) }}, gdb.BEGIN: {Name: "begin", Help: "开始", Hand: func(m *ice.Message, arg ...string) { diff --git a/misc/chrome/chrome.shy b/misc/chrome/chrome.shy index 3da810ec..b8dc6182 100644 --- a/misc/chrome/chrome.shy +++ b/misc/chrome/chrome.shy @@ -8,10 +8,17 @@ refer "官网" ` ` chapter "应用" -section "启动本地应用" +field draw web.wiki.draw.draw args hi.svg +field trend web.code.git.trend args icebergs +field spide web.code.git.spide args icebergs + +chapter "本地" refer ` 终端 terminal:// 博客 https://www.cnblogs.com/lymvv/p/8431238.html ` -other "https://www.cnblogs.com/lymvv/p/8431238.html" -baidu "html" +field chrome web.code.chrome.chrome +field bookmark web.code.chrome.bookmark + +# other "https://www.cnblogs.com/lymvv/p/8431238.html" +# baidu "html" diff --git a/misc/git/git.shy b/misc/git/git.shy index ec756306..043de52b 100644 --- a/misc/git/git.shy +++ b/misc/git/git.shy @@ -6,5 +6,6 @@ refer "官网" ` 源码 https://github.com/git/git ` +chapter "应用" field status web.code.git.status field total web.code.git.total diff --git a/misc/tmux/tmux.shy b/misc/tmux/tmux.shy new file mode 100644 index 00000000..41d91ba2 --- /dev/null +++ b/misc/tmux/tmux.shy @@ -0,0 +1,11 @@ +title "tmux" + +refer "官网" ` +官网 http://tmux.github.io/ +文档 https://git-scm.com/docs +源码 https://github.com/tmux/tmux +` +chapter "应用" +field text web.code.tmux.text +field buffer web.code.tmux.buffer args 0 +field session web.code.tmux.session diff --git a/misc/vim/vim.shy b/misc/vim/vim.shy index 7b50e590..1c6711b6 100644 --- a/misc/vim/vim.shy +++ b/misc/vim/vim.shy @@ -6,10 +6,14 @@ refer "官网" ` 文档 http://vimdoc.sourceforge.net/htmldoc/usr_toc.html ` -field "启动配置" web.code.inner args `[ etc/conf/ vimrc ]` +chapter "应用" + +chapter "操作" chapter "配置" +field "启动配置" web.code.inner args `[ etc/conf/ vimrc ]` + chapter "插件" refer ` diff --git a/misc/zsh/zsh.shy b/misc/zsh/zsh.shy new file mode 100644 index 00000000..f048dc4d --- /dev/null +++ b/misc/zsh/zsh.shy @@ -0,0 +1 @@ +title "zsh"