mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 10:12:02 +08:00
opt autogen
This commit is contained in:
parent
6d993365a3
commit
fbf24e1100
@ -411,6 +411,7 @@ const (
|
|||||||
IMPORT = "import"
|
IMPORT = "import"
|
||||||
PRUNES = "prunes"
|
PRUNES = "prunes"
|
||||||
INPUTS = "inputs"
|
INPUTS = "inputs"
|
||||||
|
SCRIPT = "script"
|
||||||
COMMIT = "commit"
|
COMMIT = "commit"
|
||||||
SOURCE = "source"
|
SOURCE = "source"
|
||||||
)
|
)
|
||||||
|
@ -5,8 +5,10 @@ import (
|
|||||||
"github.com/shylinux/icebergs/base/cli"
|
"github.com/shylinux/icebergs/base/cli"
|
||||||
"github.com/shylinux/icebergs/base/mdb"
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
"github.com/shylinux/icebergs/base/nfs"
|
"github.com/shylinux/icebergs/base/nfs"
|
||||||
|
"github.com/shylinux/icebergs/base/web"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
|
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -71,7 +73,7 @@ const AUTOGEN = "autogen"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{
|
Index.Merge(&ice.Context{
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
AUTOGEN: {Name: "autogen path auto create binpack", Help: "生成", Action: map[string]*ice.Action{
|
AUTOGEN: {Name: "autogen path auto create binpack script", Help: "生成", Action: map[string]*ice.Action{
|
||||||
mdb.CREATE: {Name: "create main=src/main.go@key name=hi@key from=usr/icebergs/misc/bash/bash.go@key", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create main=src/main.go@key name=hi@key from=usr/icebergs/misc/bash/bash.go@key", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if p := path.Join("src", m.Option("name"), m.Option("name")+".shy"); !kit.FileExists(p) {
|
if p := path.Join("src", m.Option("name"), m.Option("name")+".shy"); !kit.FileExists(p) {
|
||||||
_autogen_script(m, p)
|
_autogen_script(m, p)
|
||||||
@ -85,9 +87,6 @@ func init() {
|
|||||||
m.Cmdy(cli.SYSTEM, "make")
|
m.Cmdy(cli.SYSTEM, "make")
|
||||||
m.Option(ice.MSG_PROCESS, ice.PROCESS_INNER)
|
m.Option(ice.MSG_PROCESS, ice.PROCESS_INNER)
|
||||||
}},
|
}},
|
||||||
BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(BINPACK, mdb.CREATE)
|
|
||||||
}},
|
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "main":
|
case "main":
|
||||||
@ -103,6 +102,16 @@ func init() {
|
|||||||
m.RenameAppend("path", arg[0])
|
m.RenameAppend("path", arg[0])
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(BINPACK, mdb.CREATE)
|
||||||
|
}},
|
||||||
|
mdb.SCRIPT: {Name: "script", Help: "脚本", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
miss := "etc/miss.sh"
|
||||||
|
if _, e := os.Stat(miss); os.IsNotExist(e) {
|
||||||
|
m.Cmd(nfs.SAVE, miss, m.Conf(web.DREAM, "meta.miss"))
|
||||||
|
}
|
||||||
|
m.Echo(miss)
|
||||||
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if m.Option(nfs.DIR_ROOT, "src"); len(arg) == 0 || strings.HasSuffix(arg[0], "/") {
|
if m.Option(nfs.DIR_ROOT, "src"); len(arg) == 0 || strings.HasSuffix(arg[0], "/") {
|
||||||
m.Cmdy(nfs.DIR, kit.Select("./", arg, 0))
|
m.Cmdy(nfs.DIR, kit.Select("./", arg, 0))
|
||||||
|
@ -28,6 +28,7 @@ func init() {
|
|||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
COMPILE: {Name: "compile arch=amd64,386,arm os=linux,darwin,windows src=src/main.go@key 执行:button", Help: "编译", Action: map[string]*ice.Action{
|
COMPILE: {Name: "compile arch=amd64,386,arm os=linux,darwin,windows src=src/main.go@key 执行:button", Help: "编译", Action: map[string]*ice.Action{
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Option(nfs.DIR_REG, `.*\.go$`)
|
||||||
m.Cmdy(nfs.DIR, "src", "path,size,time")
|
m.Cmdy(nfs.DIR, "src", "path,size,time")
|
||||||
m.Sort(kit.MDB_PATH)
|
m.Sort(kit.MDB_PATH)
|
||||||
}},
|
}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user