mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
opt bash.grant
This commit is contained in:
parent
80eda9d0c8
commit
50f7e56449
@ -22,7 +22,7 @@ func _zone_select(m *ice.Message, prefix, chain, zone string, id string) {
|
|||||||
cb := m.Optionv(kit.Keycb(SELECT))
|
cb := m.Optionv(kit.Keycb(SELECT))
|
||||||
m.Richs(prefix, chain, kit.Select(kit.MDB_FOREACH, zone), func(key string, val map[string]interface{}) {
|
m.Richs(prefix, chain, kit.Select(kit.MDB_FOREACH, zone), func(key string, val map[string]interface{}) {
|
||||||
if val = kit.GetMeta(val); zone == "" {
|
if val = kit.GetMeta(val); zone == "" {
|
||||||
if m.Option(FIELDS) == DETAIL {
|
if m.OptionFields() == DETAIL {
|
||||||
m.Push(DETAIL, val)
|
m.Push(DETAIL, val)
|
||||||
} else {
|
} else {
|
||||||
m.Push(key, val, fields)
|
m.Push(key, val, fields)
|
||||||
|
@ -207,7 +207,9 @@ func init() {
|
|||||||
m.Cmdy(TRASH, m.Option(kit.MDB_PATH))
|
m.Cmdy(TRASH, m.Option(kit.MDB_PATH))
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Info("dir_root: %v", m.Option(DIR_ROOT))
|
if m.Option(DIR_ROOT) != "" {
|
||||||
|
m.Info("dir_root: %v", m.Option(DIR_ROOT))
|
||||||
|
}
|
||||||
_dir_list(m, kit.Select("./", m.Option(DIR_ROOT)), kit.Select("./", arg, 0),
|
_dir_list(m, kit.Select("./", m.Option(DIR_ROOT)), kit.Select("./", arg, 0),
|
||||||
0, m.Option(DIR_DEEP) == ice.TRUE, kit.Select(TYPE_BOTH, m.Option(DIR_TYPE)), kit.Regexp(m.Option(DIR_REG)),
|
0, m.Option(DIR_DEEP) == ice.TRUE, kit.Select(TYPE_BOTH, m.Option(DIR_TYPE)), kit.Regexp(m.Option(DIR_REG)),
|
||||||
kit.Split(kit.Select(kit.Select("time,path,size,action", m.OptionFields()), kit.Join(kit.Slice(arg, 1)))))
|
kit.Split(kit.Select(kit.Select("time,path,size,action", m.OptionFields()), kit.Join(kit.Slice(arg, 1)))))
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
type {{.Option "name"}} struct {
|
type {{.Option "name"}} struct {
|
||||||
ice.{{.Option "type"}}
|
ice.{{.Option "type"}}
|
||||||
|
|
||||||
list string {{.Option "tag"}}
|
list string {{.Option "tags"}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h {{.Option "name"}}) List(m *ice.Message, arg ...string) {
|
func (h {{.Option "name"}}) List(m *ice.Message, arg ...string) {
|
||||||
@ -163,7 +163,7 @@ func init() {
|
|||||||
case "Data":
|
case "Data":
|
||||||
_defs(m, "list", m.Option(kit.MDB_NAME)+" path auto upload")
|
_defs(m, "list", m.Option(kit.MDB_NAME)+" path auto upload")
|
||||||
}
|
}
|
||||||
m.Option("tag", kit.Format("`name:\"%s\" help:\"%s\"`", m.Option("list"), m.Option("help")))
|
m.Option("tags", kit.Format("`name:\"%s\" help:\"%s\"`", m.Option("list"), m.Option("help")))
|
||||||
|
|
||||||
if p := path.Join(ice.SRC, m.Option(kit.MDB_ZONE), kit.Keys(m.Option(kit.MDB_NAME), GO)); !kit.FileExists(p) {
|
if p := path.Join(ice.SRC, m.Option(kit.MDB_ZONE), kit.Keys(m.Option(kit.MDB_NAME), GO)); !kit.FileExists(p) {
|
||||||
_autogen_module(m, p)
|
_autogen_module(m, p)
|
||||||
|
@ -76,6 +76,12 @@ func init() {
|
|||||||
"throw",
|
"throw",
|
||||||
"catch",
|
"catch",
|
||||||
"finally",
|
"finally",
|
||||||
|
|
||||||
|
"can",
|
||||||
|
"sub",
|
||||||
|
"msg",
|
||||||
|
"res",
|
||||||
|
"target",
|
||||||
),
|
),
|
||||||
FUNCTION, kit.Simple(
|
FUNCTION, kit.Simple(
|
||||||
"window",
|
"window",
|
||||||
@ -101,10 +107,6 @@ func init() {
|
|||||||
"cb",
|
"cb",
|
||||||
"cbs",
|
"cbs",
|
||||||
"shy",
|
"shy",
|
||||||
"can",
|
|
||||||
"sub",
|
|
||||||
"msg",
|
|
||||||
"res",
|
|
||||||
"pane",
|
"pane",
|
||||||
"plugin",
|
"plugin",
|
||||||
),
|
),
|
||||||
|
@ -37,11 +37,6 @@ func init() {
|
|||||||
AUTOGEN: {Name: "create main=src/main.go@key key zone type=Zone,Hash,Data name=hi list help", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
AUTOGEN: {Name: "create main=src/main.go@key key zone type=Zone,Hash,Data name=hi list help", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(AUTOGEN, mdb.CREATE, arg)
|
m.Cmdy(AUTOGEN, mdb.CREATE, arg)
|
||||||
}},
|
}},
|
||||||
BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(AUTOGEN, BINPACK)
|
|
||||||
m.Cmd(nfs.COPY, ice.GO_MOD, path.Join(ice.SRC_RELEASE, ice.GO_MOD))
|
|
||||||
m.ProcessInner()
|
|
||||||
}},
|
|
||||||
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Cmdy(COMPILE, ice.SRC_MAIN_GO); cli.IsSuccess(m) {
|
if m.Cmdy(COMPILE, ice.SRC_MAIN_GO); cli.IsSuccess(m) {
|
||||||
m.Cmd(COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN)
|
m.Cmd(COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN)
|
||||||
@ -49,6 +44,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.ProcessInner()
|
m.ProcessInner()
|
||||||
}},
|
}},
|
||||||
|
BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(AUTOGEN, BINPACK)
|
||||||
|
m.Cmd(nfs.COPY, ice.GO_MOD, path.Join(ice.SRC_RELEASE, ice.GO_MOD))
|
||||||
|
m.ProcessInner()
|
||||||
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Cmdy(INNER, arg)
|
m.Cmdy(INNER, arg)
|
||||||
}},
|
}},
|
||||||
|
@ -43,6 +43,12 @@ func init() {
|
|||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
ice.AddRender(ice.RENDER_SCRIPT, func(m *ice.Message, cmd string, args ...interface{}) string {
|
ice.AddRender(ice.RENDER_SCRIPT, func(m *ice.Message, cmd string, args ...interface{}) string {
|
||||||
arg := kit.Simple(args...)
|
arg := kit.Simple(args...)
|
||||||
|
if m.IsCliUA() {
|
||||||
|
if len(arg) > 1 {
|
||||||
|
arg = arg[1:]
|
||||||
|
}
|
||||||
|
return strings.Join(arg, ice.NL)
|
||||||
|
}
|
||||||
if len(arg) == 1 && arg[0] != BREAK {
|
if len(arg) == 1 && arg[0] != BREAK {
|
||||||
arg = []string{SHELL, arg[0]}
|
arg = []string{SHELL, arg[0]}
|
||||||
}
|
}
|
||||||
|
@ -11,38 +11,35 @@ import (
|
|||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
const RUN = "run"
|
func _run_action(m *ice.Message, cmd *ice.Command, code string, arg ...string) {
|
||||||
|
m.Set(ice.MSG_RESULT)
|
||||||
|
m.Echo("#/bin/bash\n")
|
||||||
|
|
||||||
func init() {
|
list := []string{}
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
args := []string{}
|
||||||
"/run/": {Name: "/run/", Help: "执行", Action: ice.MergeAction(map[string]*ice.Action{
|
kit.Fetch(cmd.Meta["_trans"], func(k string, v string) {
|
||||||
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
list = append(list, k)
|
||||||
m.Search(arg[0], func(_ *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
args = append(args, kit.Format(` %s)`, k))
|
||||||
p := strings.ReplaceAll(kit.Select("/app/cat.sh", cmd.Meta["display"]), ".js", ".sh")
|
kit.Fetch(cmd.Meta[k], func(index int, value map[string]interface{}) {
|
||||||
if strings.HasPrefix(p, ice.PS+ice.REQUIRE) {
|
args = append(args, kit.Format(` read -p "input %s: " v; url="$url/%s/$v" `, value[kit.MDB_NAME], value[kit.MDB_NAME]))
|
||||||
m.Cmdy(web.SPIDE, ice.DEV, web.SPIDE_RAW, p)
|
})
|
||||||
} else {
|
args = append(args, kit.Format(` ;;`))
|
||||||
m.Cmdy(nfs.CAT, path.Join(ice.USR_INTSHELL, p))
|
})
|
||||||
}
|
|
||||||
m.Debug(kit.Formats(cmd.Meta))
|
m.Echo(`
|
||||||
if m.Result() == "" || m.Result(1) == ice.ErrNotFound {
|
ish_sys_dev_run_source() {
|
||||||
m.Set(ice.MSG_RESULT)
|
select action in %s; do
|
||||||
m.Echo("#/bin/bash\n")
|
local url="run/action/run/%s/action/$action"
|
||||||
list := []string{}
|
case $action in
|
||||||
args := []string{}
|
%s
|
||||||
kit.Fetch(cmd.Meta["_trans"], func(k string, v string) {
|
esac
|
||||||
list = append(list, k)
|
ish_sys_dev_source $url
|
||||||
args = append(args, kit.Format(` %s)`, k))
|
done
|
||||||
kit.Fetch(cmd.Meta[k], func(index int, value map[string]interface{}) {
|
}
|
||||||
args = append(args, kit.Format(` read -p "read %s: " v; url="$url/%s/$v" `, value[kit.MDB_NAME], value[kit.MDB_NAME]))
|
`, kit.Join(list, ice.SP), arg[0], kit.Join(args, ice.NL))
|
||||||
})
|
m.Echo(`
|
||||||
args = append(args, kit.Format(` ;;`))
|
|
||||||
})
|
|
||||||
list = append(list, "quit")
|
|
||||||
m.Echo(`
|
|
||||||
ish_sys_dev_run_action() {
|
ish_sys_dev_run_action() {
|
||||||
select action in %s; do
|
select action in %s; do
|
||||||
if [ "$action" = "quit" ]; then break; fi
|
|
||||||
local url="run/action/run/%s/action/$action"
|
local url="run/action/run/%s/action/$action"
|
||||||
case $action in
|
case $action in
|
||||||
%s
|
%s
|
||||||
@ -52,9 +49,39 @@ ish_sys_dev_run_action() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
`, kit.Join(list, ice.SP), arg[0], kit.Join(args, ice.NL))
|
`, kit.Join(list, ice.SP), arg[0], kit.Join(args, ice.NL))
|
||||||
m.Echo("cat $1\n")
|
|
||||||
m.Debug("what %v", m.Result())
|
m.Echo(ice.NL)
|
||||||
|
m.Echo(`ish_sys_dev_run_command() {
|
||||||
|
ish_sys_dev_run %s "$@"
|
||||||
|
}
|
||||||
|
`, arg[0])
|
||||||
|
m.Echo(ice.NL)
|
||||||
|
|
||||||
|
if code == "" {
|
||||||
|
m.Echo("cat $1")
|
||||||
|
} else {
|
||||||
|
m.Echo(code)
|
||||||
|
}
|
||||||
|
m.Echo(ice.NL)
|
||||||
|
m.Debug(m.Result())
|
||||||
|
}
|
||||||
|
|
||||||
|
const RUN = "run"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||||
|
"/run/": {Name: "/run/", Help: "执行", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
|
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Search(arg[0], func(_ *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
||||||
|
if p := strings.ReplaceAll(kit.Select("/app/cat.sh", cmd.Meta["display"]), ".js", ".sh"); strings.HasPrefix(p, ice.PS+ice.REQUIRE) {
|
||||||
|
m.Cmdy(web.SPIDE, ice.DEV, web.SPIDE_RAW, p)
|
||||||
|
} else {
|
||||||
|
m.Cmdy(nfs.CAT, path.Join(ice.USR_INTSHELL, p))
|
||||||
}
|
}
|
||||||
|
if m.Result() == "" || m.Result(1) == ice.ErrNotFound {
|
||||||
|
m.Set(ice.MSG_RESULT)
|
||||||
|
}
|
||||||
|
_run_action(m, cmd, m.Result(), arg...)
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -65,10 +92,6 @@ ish_sys_dev_run_action() {
|
|||||||
m.Table()
|
m.Table()
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, ctx.CmdAction())},
|
||||||
if m.Right(arg) {
|
}})
|
||||||
m.Cmdy(arg)
|
|
||||||
}
|
|
||||||
}}},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,9 @@ func init() {
|
|||||||
m.Option(ice.MSG_USERNAME, msg.Append(GRANT))
|
m.Option(ice.MSG_USERNAME, msg.Append(GRANT))
|
||||||
m.Option(ice.MSG_USERROLE, aaa.UserRole(m, msg.Append(GRANT)))
|
m.Option(ice.MSG_USERROLE, aaa.UserRole(m, msg.Append(GRANT)))
|
||||||
m.Option(tcp.HOSTNAME, msg.Append(tcp.HOSTNAME))
|
m.Option(tcp.HOSTNAME, msg.Append(tcp.HOSTNAME))
|
||||||
|
if arg[0] == "/run/" {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg)
|
m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg)
|
||||||
}},
|
}},
|
||||||
"/qrcode": {Name: "/qrcode", Help: "二维码", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"/qrcode": {Name: "/qrcode", Help: "二维码", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user