mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 17:18:05 +08:00
opt some
This commit is contained in:
parent
4548e3a62f
commit
faf74492ef
@ -49,10 +49,13 @@ const VIMER = "vimer"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
web.Index.MergeCommands(ice.Commands{
|
web.Index.MergeCommands(ice.Commands{
|
||||||
ice.REQUIRE_SRC: {Actions: ice.MergeActions(ctx.CmdAction(), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
ice.REQUIRE_SRC: {Actions: ice.MergeActions(ctx.CmdAction(), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) { web.ShareLocalFile(m, ice.SRC, path.Join(arg...)) }},
|
||||||
web.ShareLocalFile(m, ice.SRC, path.Join(arg...))
|
|
||||||
}},
|
|
||||||
ice.REQUIRE_USR: {Hand: func(m *ice.Message, arg ...string) { web.ShareLocalFile(m, ice.USR, path.Join(arg...)) }},
|
ice.REQUIRE_USR: {Hand: func(m *ice.Message, arg ...string) { web.ShareLocalFile(m, ice.USR, path.Join(arg...)) }},
|
||||||
|
ice.REQUIRE_MODULES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
p := path.Join(ice.USR_MODULES, path.Join(arg...))
|
||||||
|
kit.If(!nfs.Exists(m, p), func() { m.Cmd(cli.SYSTEM, "npm", "install", arg[0], kit.Dict(cli.CMD_DIR, ice.USR)) })
|
||||||
|
m.RenderDownload(p)
|
||||||
|
}},
|
||||||
})
|
})
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
VIMER: {Name: "vimer path=src/@key file=main.go line=1 list", Help: "编辑器", Meta: kit.Dict(ctx.STYLE, INNER), Actions: ice.MergeActions(ice.Actions{
|
VIMER: {Name: "vimer path=src/@key file=main.go line=1 list", Help: "编辑器", Meta: kit.Dict(ctx.STYLE, INNER), Actions: ice.MergeActions(ice.Actions{
|
||||||
|
2
go.mod
2
go.mod
@ -5,6 +5,6 @@ go 1.13
|
|||||||
require (
|
require (
|
||||||
shylinux.com/x/go-git/v5 v5.6.3
|
shylinux.com/x/go-git/v5 v5.6.3
|
||||||
shylinux.com/x/go-qrcode v0.0.2
|
shylinux.com/x/go-qrcode v0.0.2
|
||||||
shylinux.com/x/toolkits v0.7.5
|
shylinux.com/x/toolkits v0.7.6
|
||||||
shylinux.com/x/websocket v0.0.2
|
shylinux.com/x/websocket v0.0.2
|
||||||
)
|
)
|
||||||
|
4
go.sum
4
go.sum
@ -2,7 +2,7 @@ shylinux.com/x/go-git/v5 v5.6.3 h1:TgxQSryjeDVOA33eYF8s+URzC3xdXsfJQaJAyq1liz0=
|
|||||||
shylinux.com/x/go-git/v5 v5.6.3/go.mod h1:FiJKLqM5ppFERgywelAfywwxc7UxpaYN5YH3Lhc2gys=
|
shylinux.com/x/go-git/v5 v5.6.3/go.mod h1:FiJKLqM5ppFERgywelAfywwxc7UxpaYN5YH3Lhc2gys=
|
||||||
shylinux.com/x/go-qrcode v0.0.2 h1:/c0PLj+1RT+kUPfnZVXwgbgH5m1SxBUjM2MIKXbDk+E=
|
shylinux.com/x/go-qrcode v0.0.2 h1:/c0PLj+1RT+kUPfnZVXwgbgH5m1SxBUjM2MIKXbDk+E=
|
||||||
shylinux.com/x/go-qrcode v0.0.2/go.mod h1:TlzGBENHXy19xC3AsC6h4Vs5fx2ZuDA4TZ0U3C2OeK4=
|
shylinux.com/x/go-qrcode v0.0.2/go.mod h1:TlzGBENHXy19xC3AsC6h4Vs5fx2ZuDA4TZ0U3C2OeK4=
|
||||||
shylinux.com/x/toolkits v0.7.5 h1:OHk2zLWubFion4cJBo+lSTyzBp3buzV7Xu/Q91Hvf7M=
|
shylinux.com/x/toolkits v0.7.6 h1:QwRxrS2uDHbT9MegM26gtq9j5qojmahOHVDAp1eVEms=
|
||||||
shylinux.com/x/toolkits v0.7.5/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
|
shylinux.com/x/toolkits v0.7.6/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||||
shylinux.com/x/websocket v0.0.2 h1:aeeZyAsh6QN7+l5oMXlO9/rlQgx6CHvDtpZyAqMCSlU=
|
shylinux.com/x/websocket v0.0.2 h1:aeeZyAsh6QN7+l5oMXlO9/rlQgx6CHvDtpZyAqMCSlU=
|
||||||
shylinux.com/x/websocket v0.0.2/go.mod h1:yMcu4XS6JB11YRISXwvubh7dPM6rWPdzIRv0CrshQBY=
|
shylinux.com/x/websocket v0.0.2/go.mod h1:yMcu4XS6JB11YRISXwvubh7dPM6rWPdzIRv0CrshQBY=
|
||||||
|
@ -1,25 +1,15 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
|
||||||
|
|
||||||
"shylinux.com/x/ice"
|
"shylinux.com/x/ice"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type npm struct {
|
type npm struct {
|
||||||
ice.Code
|
ice.Code
|
||||||
require string `name:"require" http:"/require/modules/"`
|
|
||||||
list string `name:"list auto"`
|
list string `name:"list auto"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s npm) Require(m *ice.Message, arg ...string) {
|
|
||||||
p := path.Join(ice.USR_MODULES, path.Join(arg...))
|
|
||||||
kit.If(!nfs.Exists(m, p), func() { m.Cmd(cli.SYSTEM, "npm", "install", arg[0], kit.Dict(cli.CMD_DIR, ice.USR)) })
|
|
||||||
m.RenderDownload(p)
|
|
||||||
}
|
|
||||||
func (s npm) List(m *ice.Message) {
|
func (s npm) List(m *ice.Message) {
|
||||||
m.Cmdy(nfs.DIR, ice.USR_MODULES)
|
m.Cmdy(nfs.DIR, ice.USR_MODULES)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user