1
0
forked from x/icebergs
This commit is contained in:
shaoying 2020-07-07 22:33:03 +08:00
parent 1e09b9c34c
commit 117b55ef8f
4 changed files with 14 additions and 5 deletions

View File

@ -98,7 +98,7 @@ func init() {
Commands: map[string]*ice.Command{
COMMAND: {Name: "command [all] command", Help: "命令", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
all, arg := _parse_arg_all(m, arg...)
_command_list(m, all, kit.Select("", arg, 0))
_command_list(m, all, strings.Join(arg, "."))
}},
},
}, nil)

View File

@ -1,12 +1,12 @@
package ssh
import (
"github.com/shylinux/icebergs"
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/aaa"
"github.com/shylinux/icebergs/base/cli"
"github.com/shylinux/icebergs/base/mdb"
"github.com/shylinux/icebergs/base/web"
"github.com/shylinux/toolkits"
kit "github.com/shylinux/toolkits"
"bufio"
"bytes"
@ -332,6 +332,10 @@ var Index = &ice.Context{Name: "ssh", Help: "终端模块",
}},
SOURCE: {Name: "source file", Help: "脚本解析", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if _, e := os.Stat(arg[0]); e != nil {
arg[0] = path.Join(path.Dir(m.Option("_script")), arg[0])
}
m.Option("_script", arg[0])
m.Starts(strings.Replace(arg[0], ".", "_", -1), arg[0], arg[0:]...)
}},
TARGET: {Name: "target name", Help: "当前模块", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {

View File

@ -286,7 +286,7 @@ func init() {
STACK: {Name: "stack", Help: "结构", Value: kit.Data("template", stack)},
WORD: {Name: "word", Help: "语言文字", Value: kit.Data(kit.MDB_SHORT, "name",
"path", "usr/demo", "regs", ".*\\.shy", "alias", map[string]interface{}{
"path", "usr", "regs", ".*\\.shy", "alias", map[string]interface{}{
LABEL: []interface{}{CHART, LABEL},
CHAIN: []interface{}{CHART, CHAIN},

View File

@ -388,7 +388,12 @@ func (m *Message) Split(str string, field string, space string, enter string) *M
continue
}
for i, v := range kit.Split(l, space, space) {
ls := kit.Split(l, space, space)
for i, v := range ls {
if i == len(fields)-1 {
m.Push(kit.Select("some", fields, i), strings.Join(ls[i:], space))
break
}
m.Push(kit.Select("some", fields, i), v)
}
}