1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-01 19:19:24 +08:00
This commit is contained in:
shaoying 2020-08-05 22:58:32 +08:00
parent 5f3f1044d2
commit bbff450bf9
8 changed files with 67 additions and 7 deletions

View File

@ -1,11 +1,14 @@
package cli package cli
import ( import (
"bytes"
ice "github.com/shylinux/icebergs" ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/ctx" "github.com/shylinux/icebergs/base/ctx"
"github.com/shylinux/icebergs/base/mdb" "github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits" kit "github.com/shylinux/toolkits"
"io/ioutil"
"os" "os"
"os/user" "os/user"
"path" "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) { RUNTIME: {Name: "runtime name auto", Help: "运行环境", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
switch kit.Select("", arg, 0) { switch kit.Select("", arg, 0) {
case "procinfo":
m.Split(m.Cmdx(SYSTEM, "ps"), "", " ", "\n")
case "hostinfo": 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": case "hostname":
m.Conf(RUNTIME, "boot.hostname", arg[1]) m.Conf(RUNTIME, "boot.hostname", arg[1])
HostName = arg[1] HostName = arg[1]

View File

@ -39,6 +39,10 @@ func init() {
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(cli.SYSTEM, path.Join(arg[2], arg[1])) 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) {}}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
}, },
Configs: map[string]*ice.Config{ Configs: map[string]*ice.Config{

View File

@ -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, "添加", _task_inputs,
"display", "/plugin/local/team/plan.js", "detail", []string{StatusPrepare, StatusProcess, StatusCancel, StatusFinish}, "display", "/plugin/local/team/plan.js", "detail", []string{StatusPrepare, StatusProcess, StatusCancel, StatusFinish},
"style", "plan", "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)) _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) { 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) { 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) { gdb.BEGIN: {Name: "begin", Help: "开始", Hand: func(m *ice.Message, arg ...string) {

View File

@ -8,10 +8,17 @@ refer "官网" `
` `
chapter "应用" 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 ` refer `
终端 terminal:// 终端 terminal://
博客 https://www.cnblogs.com/lymvv/p/8431238.html 博客 https://www.cnblogs.com/lymvv/p/8431238.html
` `
other "https://www.cnblogs.com/lymvv/p/8431238.html" field chrome web.code.chrome.chrome
baidu "html" field bookmark web.code.chrome.bookmark
# other "https://www.cnblogs.com/lymvv/p/8431238.html"
# baidu "html"

View File

@ -6,5 +6,6 @@ refer "官网" `
源码 https://github.com/git/git 源码 https://github.com/git/git
` `
chapter "应用"
field status web.code.git.status field status web.code.git.status
field total web.code.git.total field total web.code.git.total

11
misc/tmux/tmux.shy Normal file
View File

@ -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

View File

@ -6,10 +6,14 @@ refer "官网" `
文档 http://vimdoc.sourceforge.net/htmldoc/usr_toc.html 文档 http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
` `
field "启动配置" web.code.inner args `[ etc/conf/ vimrc ]` chapter "应用"
chapter "操作"
chapter "配置" chapter "配置"
field "启动配置" web.code.inner args `[ etc/conf/ vimrc ]`
chapter "插件" chapter "插件"
refer ` refer `

1
misc/zsh/zsh.shy Normal file
View File

@ -0,0 +1 @@
title "zsh"