diff --git a/base/tcp/wifi.go b/base/tcp/wifi.go new file mode 100644 index 00000000..b4bd6c56 --- /dev/null +++ b/base/tcp/wifi.go @@ -0,0 +1,39 @@ +package tcp + +import ( + "strings" + + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/aaa" + "shylinux.com/x/icebergs/base/lex" + "shylinux.com/x/icebergs/base/mdb" + kit "shylinux.com/x/toolkits" +) + +const WIFI = "wifi" + +func init() { + const ( + SYSTEM = "cli.system" + NETWORKSETUP = "networksetup" + DISCOVER = "discover" + CONNECT = "connect" + ) + Index.MergeCommands(ice.Commands{ + WIFI: {Help: "无线", Actions: ice.MergeActions(ice.Actions{ + DISCOVER: {Help: "查找", Hand: func(m *ice.Message, arg ...string) { + m.Push(mdb.NAME, strings.Split(m.Cmdx(SYSTEM, NETWORKSETUP, "-listpreferredwirelessnetworks", "en0"), lex.NL)[1:]) + m.PushAction(CONNECT) + }}, + CONNECT: {Help: "连接", Hand: func(m *ice.Message, arg ...string) { + msg := mdb.HashSelect(m.Spawn(), m.Option(mdb.NAME, strings.TrimSpace(m.Option(mdb.NAME)))) + m.Cmd(SYSTEM, NETWORKSETUP, "-setairportnetwork", "en0", kit.Select(m.Option(mdb.NAME), msg.Append(mdb.NAME)), msg.Append(aaa.PASSWORD)) + m.ProcessHold() + }}, + }, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,password")), Hand: func(m *ice.Message, arg ...string) { + if mdb.HashSelect(m, arg...).PushAction(CONNECT, mdb.REMOVE).Action(mdb.CREATE, DISCOVER); len(arg) > 0 { + m.EchoQRCode(kit.Format("WIFI:T:WPA;S:%s;P:%s;H:false;;", m.Append(mdb.NAME), m.Append(aaa.PASSWORD))) + } + }}, + }) +} diff --git a/base/web/stats.go b/base/web/stats.go index 21127ff5..ac122f75 100644 --- a/base/web/stats.go +++ b/base/web/stats.go @@ -17,7 +17,7 @@ const STATS = "stats" func init() { Index.MergeCommands(ice.Commands{ - STATS: {Name: "stats refresh", Help: "汇总量", Meta: kit.Dict( + STATS: {Help: "汇总量", Meta: kit.Dict( ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict( "goods.amount", "商品总额", "goods.count", "商品数量", diff --git a/core/code/inner.go b/core/code/inner.go index 390b5a99..4592a57e 100644 --- a/core/code/inner.go +++ b/core/code/inner.go @@ -71,6 +71,7 @@ const ( SUFFIX = lex.SUFFIX ) const ( + INCLUDE = "include" COMMENT = "comment" KEYWORD = "keyword" CONSTANT = "constant" @@ -125,8 +126,8 @@ func init() { }}, }) } -func PlugAction() ice.Actions { - return ice.Actions{ +func PlugAction(arg ...ice.Any) ice.Actions { + return ice.MergeActions(ice.Actions{ ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { if cmd := m.Target().Commands[m.CommandKey()]; cmd != nil { if cmd.Name == "" { @@ -149,7 +150,7 @@ func PlugAction() ice.Actions { m.Cmdy(nfs.DIR, arg, kit.Dict(nfs.DIR_ROOT, ice.SRC, nfs.DIR_DEEP, ice.TRUE, nfs.DIR_REG, kit.ExtReg(m.CommandKey()))) } }}, - } + }, ctx.ConfAction(arg...)) } func LoadPlug(m *ice.Message, lang ...string) { for _, lang := range lang { diff --git a/misc/wx/wxml.go b/misc/wx/wxml.go new file mode 100644 index 00000000..6fc9bd5e --- /dev/null +++ b/misc/wx/wxml.go @@ -0,0 +1,43 @@ +package wx + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/core/code" + kit "shylinux.com/x/toolkits" +) + +func init() { + Index.MergeCommands(ice.Commands{ + "wxml": {Actions: code.PlugAction(code.PLUG, kit.Dict( + code.INCLUDE, code.HTML, + code.KEYWORD, kit.Dict( + "page", code.KEYWORD, + "view", code.KEYWORD, + "text", code.KEYWORD, + "image", code.KEYWORD, + "picker", code.KEYWORD, + "rich-text", code.KEYWORD, + "template", code.KEYWORD, + "import", code.KEYWORD, + + "class", code.FUNCTION, + "size", code.FUNCTION, + "name", code.FUNCTION, + "range", code.FUNCTION, + "value", code.FUNCTION, + "placeholder", code.FUNCTION, + "is", code.FUNCTION, + "data", code.FUNCTION, + "wx:if", code.FUNCTION, + "wx:elif", code.FUNCTION, + "wx:for", code.FUNCTION, + "wx:for-item", code.FUNCTION, + "wx:for-index", code.FUNCTION, + "wx:key", code.FUNCTION, + "bindtap", code.FUNCTION, + "bindinput", code.FUNCTION, + "bindchange", code.FUNCTION, + ), + ))}, + }) +} diff --git a/misc/wx/wxss.go b/misc/wx/wxss.go new file mode 100644 index 00000000..9068c75e --- /dev/null +++ b/misc/wx/wxss.go @@ -0,0 +1,23 @@ +package wx + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/core/code" + kit "shylinux.com/x/toolkits" +) + +func init() { + Index.MergeCommands(ice.Commands{ + "wxss": {Actions: code.PlugAction(code.PLUG, kit.Dict( + code.INCLUDE, code.CSS, + code.KEYWORD, kit.Dict( + "page", code.KEYWORD, + "view", code.KEYWORD, + "text", code.KEYWORD, + "image", code.KEYWORD, + "picker", code.KEYWORD, + "rich-text", code.KEYWORD, + ), + ))}, + }) +}