forked from x/icebergs
add package
This commit is contained in:
parent
36f92bd9a5
commit
38824867b5
@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
@ -42,6 +43,8 @@ const (
|
|||||||
CURRENT = "current"
|
CURRENT = "current"
|
||||||
RANDOM = "random"
|
RANDOM = "random"
|
||||||
END = "end"
|
END = "end"
|
||||||
|
PID = "pid"
|
||||||
|
SPACE = "space"
|
||||||
)
|
)
|
||||||
const PORT = "port"
|
const PORT = "port"
|
||||||
|
|
||||||
@ -103,24 +106,30 @@ func init() {
|
|||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Assert(m.Option(PORT) != "")
|
m.Assert(m.Option(PORT) != "")
|
||||||
nfs.Trash(m, path.Join(ice.USR_LOCAL_DAEMON, m.Option(PORT)))
|
nfs.Trash(m, path.Join(ice.USR_LOCAL_DAEMON, m.Option(PORT)))
|
||||||
|
mdb.HashRemove(m)
|
||||||
}},
|
}},
|
||||||
aaa.RIGHT: {Hand: func(m *ice.Message, arg ...string) { m.Echo(PortRight(m, arg...)) }},
|
aaa.RIGHT: {Hand: func(m *ice.Message, arg ...string) { m.Echo(PortRight(m, arg...)) }},
|
||||||
CURRENT: {Hand: func(m *ice.Message, arg ...string) { m.Echo(mdb.Config(m, CURRENT)) }},
|
CURRENT: {Hand: func(m *ice.Message, arg ...string) { m.Echo(mdb.Config(m, CURRENT)) }},
|
||||||
}, mdb.HashAction(BEGIN, 10000, END, 20000)), Hand: func(m *ice.Message, arg ...string) {
|
STOP: {Hand: func(m *ice.Message, arg ...string) { PortCmds(m, arg...); mdb.HashModify(m, PID, "") }},
|
||||||
|
START: {Hand: func(m *ice.Message, arg ...string) { PortCmds(m, arg...); mdb.HashModify(m, PID, m.Append(PID)) }},
|
||||||
|
}, mdb.HashAction(BEGIN, 10000, END, 20000,
|
||||||
|
mdb.SHORT, PORT, mdb.FIELD, "time,port,pid,cmd,name,text,icon,space,index",
|
||||||
|
)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
m.Cmdy(nfs.DIR, arg[1:], kit.Dict(nfs.DIR_ROOT, path.Join(ice.USR_LOCAL_DAEMON, arg[0])))
|
m.Cmdy(nfs.DIR, arg[1:], kit.Dict(nfs.DIR_ROOT, path.Join(ice.USR_LOCAL_DAEMON, arg[0])))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
current := kit.Int(mdb.Config(m, BEGIN))
|
current := kit.Int(mdb.Config(m, BEGIN))
|
||||||
m.Options(nfs.DIR_ROOT, ice.USR_LOCAL_DAEMON).Cmd(nfs.DIR, nfs.PWD, func(value ice.Maps) {
|
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||||
bin := m.Cmdv(nfs.DIR, path.Join(value[nfs.PATH], ice.BIN), nfs.PATH)
|
current = kit.Max(current, kit.Int(value[PORT]))
|
||||||
kit.If(bin == "", func() { bin = m.Cmdv(nfs.DIR, path.Join(value[nfs.PATH], "sbin"), nfs.PATH) })
|
if value[PID] == "" {
|
||||||
port := kit.Int(path.Base(value[nfs.PATH]))
|
m.PushButton(START, nfs.TRASH)
|
||||||
m.Push(mdb.TIME, value[mdb.TIME]).Push(PORT, port).Push(nfs.SIZE, value[nfs.SIZE]).Push(ice.BIN, strings.TrimPrefix(bin, value[nfs.PATH]))
|
} else {
|
||||||
current = kit.Max(current, port)
|
m.PushButton(STOP)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
m.PushAction(nfs.TRASH).StatusTimeCount(mdb.ConfigSimple(m, BEGIN, CURRENT, END)).SortInt(PORT)
|
|
||||||
mdb.Config(m, CURRENT, current)
|
mdb.Config(m, CURRENT, current)
|
||||||
|
m.StatusTimeCount(mdb.ConfigSimple(m, BEGIN, CURRENT, END)).SortInt(PORT)
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -128,3 +137,6 @@ func PortRight(m *ice.Message, arg ...string) string {
|
|||||||
current, begin, end := mdb.Config(m, CURRENT), mdb.Config(m, BEGIN), mdb.Config(m, END)
|
current, begin, end := mdb.Config(m, CURRENT), mdb.Config(m, BEGIN), mdb.Config(m, END)
|
||||||
return _port_right(m, kit.Int(kit.Select(kit.Select(begin, current), arg, 0)), kit.Int(kit.Select(begin, arg, 1)), kit.Int(kit.Select(end, arg, 2)))
|
return _port_right(m, kit.Int(kit.Select(kit.Select(begin, current), arg, 0)), kit.Int(kit.Select(begin, arg, 1)), kit.Int(kit.Select(end, arg, 2)))
|
||||||
}
|
}
|
||||||
|
func PortCmds(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(SPACE, m.Option(SPACE), m.Option(ctx.INDEX), m.ActionKey())
|
||||||
|
}
|
||||||
|
@ -51,3 +51,17 @@ func AdminCmd(m *ice.Message, cmd string, arg ...ice.Any) *ice.Message {
|
|||||||
return m.Cmd(append([]ice.Any{cmd}, arg...)...)
|
return m.Cmd(append([]ice.Any{cmd}, arg...)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func OpsCmd(m *ice.Message, cmd string, arg ...ice.Any) *ice.Message {
|
||||||
|
if ice.Info.NodeType == WORKER {
|
||||||
|
return m.Cmd(append([]ice.Any{SPACE, ice.OPS, cmd}, arg...)...)
|
||||||
|
} else {
|
||||||
|
return m.Cmd(append([]ice.Any{cmd}, arg...)...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func DevCmd(m *ice.Message, cmd string, arg ...ice.Any) *ice.Message {
|
||||||
|
if ice.Info.NodeType == WORKER {
|
||||||
|
return m.Cmd(append([]ice.Any{SPACE, ice.OPS, SPACE, ice.DEV, cmd}, arg...)...)
|
||||||
|
} else {
|
||||||
|
return m.Cmd(append([]ice.Any{SPACE, ice.DEV, cmd}, arg...)...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -380,6 +380,10 @@ func init() {
|
|||||||
})
|
})
|
||||||
m.Sort("", kit.Simple(aaa.LOGIN, WEIXIN, PORTAL, WORKER, SERVER, ORIGIN))
|
m.Sort("", kit.Simple(aaa.LOGIN, WEIXIN, PORTAL, WORKER, SERVER, ORIGIN))
|
||||||
} else {
|
} else {
|
||||||
|
if arg[0] == "" {
|
||||||
|
m.Cmdy(arg[1:])
|
||||||
|
return
|
||||||
|
}
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
if _space_send(m, arg[0], kit.Simple(kit.Split(arg[1]), arg[2:])...); !m.IsErrNotFoundSpace() {
|
if _space_send(m, arg[0], kit.Simple(kit.Split(arg[1]), arg[2:])...); !m.IsErrNotFoundSpace() {
|
||||||
break
|
break
|
||||||
|
@ -16,6 +16,7 @@ func init() {
|
|||||||
COMPILE, PUBLISH, UPGRADE, INSTALL,
|
COMPILE, PUBLISH, UPGRADE, INSTALL,
|
||||||
XTERM, INNER, VIMER, BENCH, PPROF,
|
XTERM, INNER, VIMER, BENCH, PPROF,
|
||||||
TEMPLATE, COMPLETE, NAVIGATE,
|
TEMPLATE, COMPLETE, NAVIGATE,
|
||||||
|
PACKAGE,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
func Prefix(arg ...ice.Any) string { return web.Prefix(CODE, kit.Keys(arg...)) }
|
func Prefix(arg ...ice.Any) string { return web.Prefix(CODE, kit.Keys(arg...)) }
|
||||||
|
@ -106,12 +106,12 @@ func _sum_show(m *ice.Message, file string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PACKAGE = "package"
|
// PACKAGE = "package"
|
||||||
IMPORT = "import"
|
IMPORT = "import"
|
||||||
CONST = "const"
|
CONST = "const"
|
||||||
TYPE = "type"
|
TYPE = "type"
|
||||||
FUNC = "func"
|
FUNC = "func"
|
||||||
VAR = "var"
|
VAR = "var"
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
MODULE = "module"
|
MODULE = "module"
|
||||||
|
@ -3,7 +3,6 @@ package code
|
|||||||
import (
|
import (
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
@ -30,20 +29,13 @@ func _install_path(m *ice.Message, link string) string {
|
|||||||
func _install_download(m *ice.Message, arg ...string) {
|
func _install_download(m *ice.Message, arg ...string) {
|
||||||
link := kit.Select(m.Option(web.LINK), arg, 0)
|
link := kit.Select(m.Option(web.LINK), arg, 0)
|
||||||
name := path.Base(kit.ParseURL(link).Path)
|
name := path.Base(kit.ParseURL(link).Path)
|
||||||
// file := path.Join(kit.Select(ice.USR_INSTALL, m.Option(nfs.PATH)), name)
|
|
||||||
file := path.Join(kit.Select(ice.USR_INSTALL, arg, 1), name)
|
file := path.Join(kit.Select(ice.USR_INSTALL, arg, 1), name)
|
||||||
// file := path.Join(ice.USR_INSTALL, name)
|
|
||||||
defer m.Cmdy(nfs.DIR, file)
|
defer m.Cmdy(nfs.DIR, file)
|
||||||
if nfs.Exists(m, file) {
|
if nfs.Exists(m, file) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
mdb.HashCreate(m.Cmd(nfs.SAVE, file, ""), mdb.NAME, name, nfs.PATH, file, web.LINK, link)
|
|
||||||
web.GoToast(m, func(toast func(string, int, int)) []string {
|
web.GoToast(m, func(toast func(string, int, int)) []string {
|
||||||
begin := time.Now()
|
_toast := func(count, total, value int) { toast(name, count, total) }
|
||||||
_toast := func(count, total, value int) {
|
|
||||||
toast(kit.FormatShow(cli.COST, kit.FmtDuration(time.Now().Sub(begin))), count, total)
|
|
||||||
mdb.HashSelectUpdate(m, name, func(value ice.Map) { value[mdb.COUNT], value[mdb.TOTAL], value[mdb.VALUE] = count, total, value })
|
|
||||||
}
|
|
||||||
defer nfs.TarExport(m, file)
|
defer nfs.TarExport(m, file)
|
||||||
if mdb.Config(m, nfs.REPOS) != "" {
|
if mdb.Config(m, nfs.REPOS) != "" {
|
||||||
web.SpideSave(m, file, mdb.Config(m, nfs.REPOS)+path.Base(link), _toast)
|
web.SpideSave(m, file, mdb.Config(m, nfs.REPOS)+path.Base(link), _toast)
|
||||||
@ -54,15 +46,13 @@ func _install_download(m *ice.Message, arg ...string) {
|
|||||||
web.SpideSave(m, file, link, _toast)
|
web.SpideSave(m, file, link, _toast)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if s, e := nfs.StatFile(m, file); e == nil && s.Size() > 0 {
|
if s, e := nfs.StatFile(m, file); e != nil || s.Size() == 0 {
|
||||||
web.ToastSuccess(m)
|
|
||||||
} else {
|
|
||||||
web.ToastFailure(m)
|
|
||||||
nfs.Trash(m, file)
|
nfs.Trash(m, file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func _install_build(m *ice.Message, arg ...string) string {
|
func _install_build(m *ice.Message, arg ...string) string {
|
||||||
p := m.Option(cli.CMD_DIR, _install_path(m, ""))
|
p := m.Option(cli.CMD_DIR, _install_path(m, ""))
|
||||||
|
defer web.ToastProcess(m, m.ActionKey(), path.Base(p))()
|
||||||
pp := kit.Path(path.Join(p, _INSTALL))
|
pp := kit.Path(path.Join(p, _INSTALL))
|
||||||
switch cb := m.Optionv(PREPARE).(type) {
|
switch cb := m.Optionv(PREPARE).(type) {
|
||||||
case func(string):
|
case func(string):
|
||||||
@ -109,6 +99,8 @@ func _install_spawn(m *ice.Message, arg ...string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
func _install_start(m *ice.Message, arg ...string) {
|
func _install_start(m *ice.Message, arg ...string) {
|
||||||
|
cmd := kit.Select(path.Join(ice.BIN, path.Base(_install_path(m, ""))), arg, 1)
|
||||||
|
defer web.ToastProcess(m, m.ActionKey(), cmd)()
|
||||||
args, p := []string{}, m.Option(cli.CMD_DIR, m.Cmdx(INSTALL, cli.SPAWN))
|
args, p := []string{}, m.Option(cli.CMD_DIR, m.Cmdx(INSTALL, cli.SPAWN))
|
||||||
switch cb := m.Optionv(PREPARE).(type) {
|
switch cb := m.Optionv(PREPARE).(type) {
|
||||||
case func(string) []string:
|
case func(string) []string:
|
||||||
@ -122,7 +114,8 @@ func _install_start(m *ice.Message, arg ...string) {
|
|||||||
m.ErrorNotImplement(cb)
|
m.ErrorNotImplement(cb)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Cmdy(cli.DAEMON, kit.Select(path.Join(ice.BIN, path.Base(_install_path(m, ""))), arg, 1), kit.Slice(arg, 2), args)
|
m.Cmdy(cli.DAEMON, cmd, kit.Slice(arg, 2), args)
|
||||||
|
m.Push(cli.CMD, cmd).Push(cli.PID, m.Result())
|
||||||
}
|
}
|
||||||
func _install_stop(m *ice.Message, arg ...string) {
|
func _install_stop(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(cli.DAEMON, func(value ice.Maps) {
|
m.Cmd(cli.DAEMON, func(value ice.Maps) {
|
||||||
@ -184,9 +177,7 @@ func init() {
|
|||||||
cli.START: {Name: "start link* cmd", Hand: func(m *ice.Message, arg ...string) { _install_start(m, arg...) }},
|
cli.START: {Name: "start link* cmd", Hand: func(m *ice.Message, arg ...string) { _install_start(m, arg...) }},
|
||||||
cli.STOP: {Hand: func(m *ice.Message, arg ...string) { _install_stop(m, arg...) }},
|
cli.STOP: {Hand: func(m *ice.Message, arg ...string) { _install_stop(m, arg...) }},
|
||||||
cli.CLEAR: {Hand: func(m *ice.Message, arg ...string) { _install_clear(m, arg...) }},
|
cli.CLEAR: {Hand: func(m *ice.Message, arg ...string) { _install_clear(m, arg...) }},
|
||||||
gdb.DEBUG: {Hand: func(m *ice.Message, arg ...string) {
|
gdb.DEBUG: {Hand: func(m *ice.Message, arg ...string) { ctx.ProcessField(m, XTERM, []string{mdb.TYPE, "gdb"}, arg...) }},
|
||||||
ctx.ProcessField(m, XTERM, []string{mdb.TYPE, "gdb"}, arg...)
|
|
||||||
}},
|
|
||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) { _install_trash(m, arg...) }},
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) { _install_trash(m, arg...) }},
|
||||||
nfs.PATH: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_install_path(m, kit.Select("", arg, 0))) }},
|
nfs.PATH: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_install_path(m, kit.Select("", arg, 0))) }},
|
||||||
nfs.SOURCE: {Name: "source link* path", Hand: func(m *ice.Message, arg ...string) {
|
nfs.SOURCE: {Name: "source link* path", Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -196,10 +187,25 @@ func init() {
|
|||||||
m.Cmdy(nfs.DIR, m.Option(nfs.PATH))
|
m.Cmdy(nfs.DIR, m.Option(nfs.PATH))
|
||||||
}},
|
}},
|
||||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { nfs.Trash(mdb.HashRemove(m), m.Option(nfs.PATH)) }},
|
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { nfs.Trash(mdb.HashRemove(m), m.Option(nfs.PATH)) }},
|
||||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,count,total,name,path,link")), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction(mdb.SHORT, "index,type", mdb.FIELD, "time,hash,index,type,name,text,icon,link")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch len(arg) {
|
switch len(arg) {
|
||||||
case 0:
|
case 0:
|
||||||
mdb.HashSelect(m, arg...).PushAction(cli.BUILD, cli.ORDER, mdb.REMOVE)
|
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||||
|
button := []ice.Any{}
|
||||||
|
switch value[mdb.TYPE] {
|
||||||
|
case nfs.BINARY:
|
||||||
|
if !nfs.Exists(m, path.Join(ice.USR_INSTALL, path.Base(value[mdb.LINK]))) {
|
||||||
|
button = append(button, web.INSTALL)
|
||||||
|
}
|
||||||
|
case nfs.SOURCE:
|
||||||
|
button = append(button, cli.START, cli.BUILD)
|
||||||
|
if !nfs.Exists(m, path.Join(ice.USR_INSTALL, path.Base(value[mdb.LINK]))) {
|
||||||
|
button = append(button, web.DOWNLOAD)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.PushButton(button...)
|
||||||
|
})
|
||||||
|
// ctx.DisplayTableCard(m)
|
||||||
case 1:
|
case 1:
|
||||||
_install_service(m, arg...)
|
_install_service(m, arg...)
|
||||||
default:
|
default:
|
||||||
@ -220,11 +226,11 @@ func InstallAction(args ...ice.Any) ice.Actions {
|
|||||||
cli.ORDER: {Help: "加载", Hand: func(m *ice.Message, arg ...string) {
|
cli.ORDER: {Help: "加载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(INSTALL, cli.ORDER, mdb.Config(m, nfs.SOURCE), path.Join(_INSTALL, ice.BIN))
|
m.Cmdy(INSTALL, cli.ORDER, mdb.Config(m, nfs.SOURCE), path.Join(_INSTALL, ice.BIN))
|
||||||
}},
|
}},
|
||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
nfs.Trash(m, m.Option(nfs.PATH))
|
|
||||||
}},
|
|
||||||
mdb.SELECT: {Name: "select path auto order build download", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SELECT: {Name: "select path auto order build download", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Options(nfs.PATH, "").Cmdy(INSTALL, mdb.ConfigSimple(m, nfs.SOURCE), arg)
|
m.Options(nfs.PATH, "").Cmdy(INSTALL, mdb.ConfigSimple(m, nfs.SOURCE), arg)
|
||||||
}},
|
}},
|
||||||
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
nfs.Trash(m, m.Option(nfs.PATH))
|
||||||
|
}},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
73
core/code/package.go
Normal file
73
core/code/package.go
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
package code
|
||||||
|
|
||||||
|
import (
|
||||||
|
"path"
|
||||||
|
|
||||||
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
|
"shylinux.com/x/icebergs/base/web"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
)
|
||||||
|
|
||||||
|
const PACKAGE = "package"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
Index.MergeCommands(ice.Commands{
|
||||||
|
PACKAGE: {Name: "package index auto", Help: "软件包", Actions: ice.MergeActions(ice.Actions{
|
||||||
|
cli.START: {Name: "start port*=10000", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if cli.IsSuccess(m.Cmdy(m.Option(ctx.INDEX), m.ActionKey(), arg)) {
|
||||||
|
web.OpsCmd(m, tcp.PORT, mdb.CREATE, m.OptionSimple(tcp.PORT, mdb.NAME, mdb.TEXT, mdb.ICON, ctx.INDEX), web.SPACE, m.Option(ice.MSG_USERPOD), m.AppendSimple(cli.CMD, cli.PID))
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
cli.BUILD: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(m.Option(ctx.INDEX), m.ActionKey(), arg)
|
||||||
|
m.Cmdy(nfs.DIR, path.Join(_install_path(m, m.Option(web.LINK)), "_install/bin/nginx"))
|
||||||
|
mdb.HashModify(m, mdb.TIME, m.Append(mdb.TIME), cli.CMD, m.Append(nfs.PATH))
|
||||||
|
}},
|
||||||
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
nfs.Trash(m, path.Join(ice.USR_INSTALL, path.Base(m.Option(web.LINK))))
|
||||||
|
nfs.Trash(m, _install_path(m, m.Option(web.LINK)))
|
||||||
|
mdb.HashModify(m, cli.CMD, "")
|
||||||
|
}},
|
||||||
|
}, mdb.HashAction(mdb.SHORT, "index", mdb.FIELD, "time,index,type,name,text,icon,cmd,link")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if kit.HasPrefixList(arg, ctx.ACTION) {
|
||||||
|
m.Cmdy(m.Option(ctx.INDEX), arg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||||
|
button := []ice.Any{}
|
||||||
|
switch value[mdb.TYPE] {
|
||||||
|
case nfs.BINARY:
|
||||||
|
kit.If(!nfs.Exists(m, _install_path(m, value[mdb.LINK])), func() {
|
||||||
|
button = append(button, web.INSTALL)
|
||||||
|
}, func() {
|
||||||
|
button = append(button, nfs.TRASH)
|
||||||
|
})
|
||||||
|
case nfs.SOURCE:
|
||||||
|
button = append(button, cli.START, cli.BUILD)
|
||||||
|
kit.If(!nfs.Exists(m, _install_path(m, value[mdb.LINK])), func() {
|
||||||
|
button = append(button, web.DOWNLOAD)
|
||||||
|
}, func() {
|
||||||
|
button = append(button, nfs.TRASH)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
m.PushButton(button...)
|
||||||
|
})
|
||||||
|
web.PushPodCmd(m, "", arg...)
|
||||||
|
kit.If(m.Option(ice.MSG_USERPOD) == "", func() { m.RenameAppend(web.SPACE, ice.POD) })
|
||||||
|
}},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
func PackageCreate(m *ice.Message, kind, name, text, icon, link string) {
|
||||||
|
if m.Cmd(PACKAGE, m.PrefixKey()).Length() > 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
m.Cmd(PACKAGE, mdb.CREATE, ctx.INDEX, m.PrefixKey(),
|
||||||
|
mdb.TYPE, kind, mdb.NAME, name, mdb.TEXT, kit.Select(path.Base(link), text),
|
||||||
|
mdb.ICON, icon, web.LINK, link,
|
||||||
|
)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user