1
0
forked from x/icebergs

add clock

This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-09-08 18:20:55 +08:00
parent 56a4be9eec
commit 890c661782
23 changed files with 92 additions and 55 deletions

View File

@ -160,7 +160,7 @@ const RUNTIME = "runtime"
func init() {
Index.MergeCommands(ice.Commands{
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,role,api,cli,cmd,mod,env,path,chain,routine auto upgrade restart logs conf", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,role,api,cli,cmd,mod,env,path,chain,routine auto upgrade restart logs conf", Icon: "usr/icons/info.png", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
aaa.White(m, ice.ETC_PATH)
aaa.White(m, ice.LICENSE)

View File

@ -175,7 +175,7 @@ const DIR = "dir"
func init() {
Index.MergeCommands(ice.Commands{
DIR: {Name: "dir path auto upload finder", Help: "目录", Actions: ice.Actions{
DIR: {Name: "dir path auto upload finder", Icon: "usr/icons/dir.png", Help: "目录", Actions: ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
aaa.White(m, ice.SRC, ice.BIN, ice.USR)
aaa.Black(m, ice.USR_LOCAL)

View File

@ -126,7 +126,7 @@ const DREAM = "dream"
func init() {
Index.MergeCommands(ice.Commands{
DREAM: {Name: "dream name@key auto create origin startall stopall", Help: "梦想家", Actions: ice.MergeActions(ice.Actions{
DREAM: {Name: "dream name@key auto create origin startall stopall cat cmd", Icon: "usr/icons/Launchpad.png", Help: "梦想家", Actions: ice.MergeActions(ice.Actions{
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
if mdb.IsSearchPreview(m, arg) {
m.Cmds("", func(value ice.Maps) { m.PushSearch(mdb.TEXT, m.MergePod(value[mdb.NAME]), value) })
@ -145,6 +145,25 @@ func init() {
gdb.Event(m, DREAM_INPUTS, arg)
}
}},
nfs.CAT: {Name: "cat file*", Hand: func(m *ice.Message, arg ...string) {
mdb.HashSelect(m.Spawn()).Table(func(value ice.Maps) {
m.Push(mdb.NAME, value[mdb.NAME])
m.Push(mdb.TEXT, m.Cmdx(SPACE, value[mdb.NAME], nfs.CAT, m.Option(nfs.FILE)))
})
m.StatusTimeCount()
}},
ice.CMD: {Name: "cmd cmd*", Hand: func(m *ice.Message, arg ...string) {
GoToast(m, "", func(toast func(string, int, int)) []string {
msg := mdb.HashSelect(m.Spawn())
msg.Table(func(index int, value ice.Maps) {
toast(value[mdb.NAME], index, msg.Length())
m.Push(mdb.NAME, value[mdb.NAME])
m.Push(mdb.TEXT, m.Cmdx(SPACE, value[mdb.NAME], kit.Split(m.Option("cmd"))))
})
return nil
})
m.StatusTimeCount()
}},
mdb.CREATE: {Name: "create name*=hi repos binary template", Hand: func(m *ice.Message, arg ...string) {
m.OptionDefault(mdb.ICON, "usr/icons/icebergs.jpg")
m.Option(nfs.REPOS, kit.Select("", kit.Slice(kit.Split(m.Option(nfs.REPOS)), -1), 0))

View File

@ -56,7 +56,7 @@ const ROUTE = "route"
func init() {
Index.MergeCommands(ice.Commands{
ROUTE: {Name: "route space:text cmds:text auto spide cmds build travel monitor prunes", Help: "路由表", Actions: ice.MergeActions(ice.Actions{
ROUTE: {Name: "route space:text cmds:text auto spide cmds build travel monitor prunes", Icon: "usr/icons/route.png", Help: "路由表", Actions: ice.MergeActions(ice.Actions{
ice.MAIN: {Help: "首页", Hand: func(m *ice.Message, arg ...string) {
ctx.ProcessField(m, CHAT_IFRAME, m.MergePod(""), arg...)
}},

15
core/chat/caculator.go Normal file
View File

@ -0,0 +1,15 @@
package chat
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
)
func init() {
const CACULATOR = "caculator"
Index.MergeCommands(ice.Commands{
CACULATOR: {Name: "caculator refresh", Icon: "usr/icons/Caculator.png", Hand: func(m *ice.Message, arg ...string) {
ctx.DisplayLocal(m, "")
}},
})
}

15
core/chat/clock.go Normal file
View File

@ -0,0 +1,15 @@
package chat
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
)
func init() {
const CLOCK = "clock"
Index.MergeCommands(ice.Commands{
CLOCK: {Name: "clock refresh", Icon: "usr/icons/Clock.png", Hand: func(m *ice.Message, arg ...string) {
ctx.DisplayLocal(m, "")
}},
})
}

View File

@ -11,7 +11,7 @@ const FLOWS = "flows"
func init() {
Index.MergeCommands(ice.Commands{
FLOWS: {Name: "flows zone hash auto", Help: "工作流", Actions: ice.MergeActions(ice.Actions{
FLOWS: {Name: "flows zone hash auto", Icon: "usr/icons/flows.png", Help: "工作流", Actions: ice.MergeActions(ice.Actions{
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
if mdb.IsSearchPreview(m, arg) {
mdb.HashSelect(m.Spawn(ice.OptionFields(""))).Table(func(value ice.Maps) {

View File

@ -13,7 +13,7 @@ const IFRAME = "iframe"
func init() {
Index.MergeCommands(ice.Commands{
IFRAME: {Name: "iframe hash@key auto safari", Help: "浏览器", Actions: ice.MergeActions(ice.Actions{
IFRAME: {Name: "iframe hash@key auto safari", Icon: "usr/icons/Safari.png", Help: "浏览器", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
if m.Cmd("").Length() == 0 {
m.Cmd(web.SPIDE, ice.OptionFields(web.CLIENT_NAME, web.CLIENT_ORIGIN), func(value ice.Maps) {

View File

@ -19,23 +19,13 @@ func init() {
Index.MergeCommands(ice.Commands{
APPLICATIONS: {Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
Notify(m, cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
FinderAppend(m, "Applications", m.PrefixKey())
AppInstall(m, "usr/icons/dir.png", nfs.DIR)
AppInstall(m, "usr/icons/Safari.png", web.CHAT_IFRAME)
AppInstall(m, "usr/icons/Terminal.png", web.CODE_XTERM)
AppInstall(m, "usr/icons/Calendar.png", web.TEAM_PLAN)
AppInstall(m, "usr/icons/Grapher.png", web.WIKI_DRAW)
AppInstall(m, "usr/icons/Photos.png", web.WIKI_FEEL)
AppInstall(m, "usr/icons/Books.png", web.WIKI_WORD)
AppInstall(m, "usr/icons/info.png", cli.RUNTIME)
AppInstall(m, "usr/icons/Mission Control.png", web.DREAM, mdb.NAME, web.DREAM)
AppInstall(m, "usr/icons/vimer.png", web.CODE_VIMER)
AppInstall(m, "usr/icons/flows.png", web.CHAT_FLOWS)
AppInstall(m, "usr/icons/go.png", web.CODE_COMPILE)
AppInstall(m, "usr/icons/git.png", web.CODE_GIT_STATUS)
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
kit.If(cmd.Icon, func() { AppInstall(m, cmd.Icon, m.PrefixKey()) })
})
Notify(m, cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
}},
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.Conf(m, m.PrefixKey(), mdb.HASH, "") }},
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1]) }},
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
switch arg[0] {

View File

@ -5,9 +5,8 @@ Volcanos(chat.ONIMPORT, {
can.onimport._menu(can), can.onimport._notifications(can), can.onimport._searchs(can), can.onimport._dock(can)
},
_menu: function(can) { can.onappend.plugin(can, {_space: can.ConfSpace(), index: "web.chat.macos.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub
sub.onexport.output = function() {
var cache = can.misc.sessionStorage(can, [can.ConfIndex(), "tabs"])
can.onimport._desktop(can, can._msg)
var cache = can.misc.sessionStorage(can, [can.ConfIndex(), "tabs"])
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
can.Conf("session") && can.runActionCommand(event, "session", [can.Conf("session")], function(msg) {
var item = msg.TableDetail(); can.onimport.session(can, can.base.Obj(item.args))
}), can.onimport.session(can, cache)
@ -121,12 +120,14 @@ Volcanos(chat.ONACTION, {list: ["full"],
} },
create: function(event, can) { can.onimport._desktop(can) },
full: function(event, can) { document.body.requestFullscreen() },
})
Volcanos(chat.ONKEYMAP, {
escape: function(event, can) { can.onmotion.hidden(can, can.ui.searchs._target) },
space: function(event, can) { can.onaction._search(can), can.onkeymap.prevent(event) },
enter: function(event, can) { can.page.Select(can, can.ui.desktop, "fieldset.select", function(target) { target._can.Update(event) }) },
ctrln: function(event, can) { can.onkeymap.selectCtrlN(event, can, can.ui.menu._output, html.DIV_TABS) },
tabs: function(event, can) { can.onaction.create(event, can) },
tabx: function(event, can) { can.page.Select(can, can.ui.menu._output, html.DIV_TABS_SELECT, function(target) { target._close() }) },
tabs: function(event, can) { can.onaction.create(event, can) },
})
Volcanos(chat.ONDETAIL, {
select: function(can, target) { can.onmotion.select(can, can.ui.desktop, html.FIELDSET, target) },

View File

@ -40,7 +40,7 @@ func init() {
VERSION = "version"
)
Index.MergeCommands(ice.Commands{
COMPILE: {Name: "compile arch=amd64,386,arm,arm64,mipsle os=linux,darwin,windows src=src/main.go@key run binpack webpack devpack install", Help: "编译", Actions: ice.MergeActions(ice.Actions{
COMPILE: {Name: "compile arch=amd64,386,arm,arm64,mipsle os=linux,darwin,windows src=src/main.go@key run binpack webpack devpack install", Icon: "usr/icons/go.png", Help: "编译", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { cli.IsAlpine(m, GO, "go git") }},
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
mdb.IsSearchPreview(m, arg, func() []string {

View File

@ -59,7 +59,7 @@ func init() {
}},
})
Index.MergeCommands(ice.Commands{
VIMER: {Name: "vimer path=src/@key file=main.go@key line=1 list", Help: "编辑器", Meta: kit.Dict(ctx.STYLE, INNER), Actions: ice.MergeActions(ice.Actions{
VIMER: {Name: "vimer path=src/@key file=main.go@key line=1 list", Icon: "usr/icons/vimer.png", Help: "编辑器", Meta: kit.Dict(ctx.STYLE, INNER), Actions: ice.MergeActions(ice.Actions{
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
if mdb.IsSearchPreview(m, arg) {
m.PushSearch(mdb.TYPE, nfs.FILE, mdb.NAME, "main", mdb.TEXT, ice.SRC_MAIN_SH)

View File

@ -74,7 +74,7 @@ const XTERM = "xterm"
func init() {
Index.MergeCommands(ice.Commands{
XTERM: {Name: "xterm hash auto install terminal", Help: "命令行", Actions: ice.MergeActions(ice.Actions{
XTERM: {Name: "xterm hash auto install terminal", Icon: "usr/icons/Terminal.png", Help: "命令行", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
kit.If(m.Cmd("").Length() == 0, func() { m.Cmd("", mdb.CREATE, mdb.TYPE, ISH) })
}},

View File

@ -55,7 +55,7 @@ const PLAN = "plan"
func init() {
Index.MergeCommands(ice.Commands{
PLAN: {Name: "plan scale=month,day,week,month,year,long begin_time@date list prev next", Help: "计划表", Actions: ice.MergeActions(ice.Actions{
PLAN: {Name: "plan scale=month,day,week,month,year,long begin_time@date list prev next", Icon: "usr/icons/Calendar.png", Help: "计划表", Actions: ice.MergeActions(ice.Actions{
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TODO, mdb.INPUTS, arg) }},
mdb.PLUGIN: {Name: "plugin extra.index extra.args", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.MODIFY, arg) }},
ice.RUN: {Hand: func(m *ice.Message, arg ...string) {

View File

@ -16,7 +16,7 @@ const DRAW = "draw"
func init() {
Index.MergeCommands(ice.Commands{
DRAW: {Name: "draw path=src/main.svg@key pid refresh save actions", Help: "思维导图", Actions: ice.MergeActions(ice.Actions{
DRAW: {Name: "draw path=src/main.svg@key pid refresh save actions", Icon: "usr/icons/Grapher.png", Help: "思维导图", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
m.Cmd(mdb.RENDER, mdb.CREATE, mdb.TYPE, nfs.SVG, mdb.NAME, m.PrefixKey())
}},

View File

@ -22,7 +22,7 @@ const FEEL = "feel"
func init() {
Index.MergeCommands(ice.Commands{
FEEL: {Name: "feel path auto prev next record1 record2 upload actions", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
FEEL: {Name: "feel path auto prev next record1 record2 upload actions", Icon: "usr/icons/Photos.png", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
"record1": {Help: "截图"}, "record2": {Help: "录屏"},
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) {
m.Option(nfs.PATH, _feel_path(m, m.Option(nfs.PATH)))

View File

@ -21,7 +21,7 @@ const WORD = "word"
func init() {
Index.MergeCommands(ice.Commands{
WORD: {Name: "word path=src/main.shy@key auto play", Help: "上下文", Actions: ice.MergeActions(ice.Actions{
WORD: {Name: "word path=src/main.shy@key auto play", Icon: "usr/icons/Books.png", Help: "上下文", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
WordAlias(m, NAVMENU, TITLE, NAVMENU)
WordAlias(m, PREMENU, TITLE, PREMENU)

View File

@ -246,10 +246,8 @@ func _repos_status(m *ice.Message, p string, repos *git.Repository) error {
switch v.Worktree {
case git.Untracked:
m.PushButton(ADD, nfs.TRASH)
case git.Modified:
m.PushButton(COMMIT)
default:
m.PushButton(COMMIT)
m.PushButton(COMMIT, CHECKOUT)
}
}
if p == path.Base(kit.Path("")) {
@ -396,16 +394,17 @@ func _repos_credentials(m *ice.Message) map[string]*url.URL {
}
const (
INIT = "init"
CLONE = "clone"
PULL = "pull"
PUSH = "push"
LOG = "log"
TAG = "tag"
ADD = "add"
STASH = "stash"
COMMIT = "commit"
BRANCH = "branch"
INIT = "init"
CLONE = "clone"
PULL = "pull"
PUSH = "push"
LOG = "log"
TAG = "tag"
ADD = "add"
STASH = "stash"
COMMIT = "commit"
BRANCH = "branch"
CHECKOUT = "checkout"
REMOTE = "remote"
ORIGIN = "origin"
@ -522,6 +521,9 @@ func init() {
}
}},
STASH: {Hand: func(m *ice.Message, arg ...string) { _repos_cmd(m, kit.Select(m.Option(REPOS), arg, 0), STASH) }},
CHECKOUT: {Help: "恢复", Hand: func(m *ice.Message, arg ...string) {
_git_cmd(m.Options(nfs.DIR_ROOT, mdb.HashSelectField(m, m.Option(REPOS), nfs.PATH)), CHECKOUT, m.Option(nfs.FILE))
}},
COMMIT: {Name: "commit actions=add,fix,opt message*=some", Help: "提交", Hand: func(m *ice.Message, arg ...string) {
if work, err := _repos_open(m, m.Option(REPOS)).Worktree(); !m.Warn(err) {
opt := &git.CommitOptions{All: true}

View File

@ -32,7 +32,7 @@ func init() {
Index.MergeCommands(ice.Commands{
SEARCH: {Name: "search repos@key keyword auto", Help: "代码源", Actions: ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
macos.AppInstall(m, "usr/icons/gitea.png", m.PrefixKey(), ctx.ARGS, kit.Format([]string{REPOS}))
macos.AppInstall(m, "usr/icons/App Store.png", m.PrefixKey(), ctx.ARGS, kit.Format([]string{REPOS}))
}},
cli.START: {Name: "start name*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(web.DREAM, mdb.CREATE); m.Cmdy(web.DREAM, cli.START) }},
CLONE: {Name: "clone name*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(REPOS, CLONE, m.Option(REPOS)) }},

View File

@ -1,6 +1,5 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
if (!can.Option(nfs.REPOS)) { return can.onappend.table(can, msg) }
_init: function(can, msg) { if (!can.Option(nfs.REPOS)) { return can.onappend.table(can, msg) }
if (can.isZoneMode()) { return can.onimport._vimer_zone(can, msg, can._output) }
can.onappend.style(can, "card", can._output)
can.page.Appends(can, can._output, msg.Table(function(value) {

View File

@ -103,7 +103,7 @@ const STATUS = "status"
func init() {
Index.MergeCommands(ice.Commands{
STATUS: {Name: "status repos:text auto", Help: "代码库", Actions: ice.MergeActions(ice.Actions{
STATUS: {Name: "status repos:text auto", Icon: "usr/icons/git.png", Help: "代码库", Actions: ice.MergeActions(ice.Actions{
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
switch m.Option(ctx.ACTION) {
case INIT:

View File

@ -22,7 +22,6 @@ import (
psh "shylinux.com/x/icebergs/base/ssh"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/core/chat/macos"
"shylinux.com/x/icebergs/misc/xterm"
kit "shylinux.com/x/toolkits"
)
@ -146,12 +145,8 @@ const SERVICE = "service"
func init() {
psh.Index.MergeCommands(ice.Commands{
SERVICE: {Name: "service port id auto listen prunes", Help: "服务", Actions: ice.MergeActions(ice.Actions{
SERVICE: {Name: "service port id auto listen prunes", Icon: "usr/icons/ssh.png", Help: "服务", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
m.Go(func() {
m.Sleep("1s")
macos.AppInstall(m, "sshd", m.Prefix(SERVICE), mdb.ICON, "usr/icons/ssh.png")
})
mdb.HashSelect(m).Table(func(value ice.Maps) {
if value[mdb.STATUS] == tcp.OPEN {
m.Cmd(SERVICE, tcp.LISTEN, tcp.PORT, value[tcp.PORT], value)

View File

@ -43,6 +43,7 @@ type Action struct {
type Command struct {
Name string
Help string
Icon string
Actions Actions
Hand Handler
RawHand Any