1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 17:44:05 +08:00
icebergs/misc/bash/bash.go
2021-06-20 11:55:53 +08:00

42 lines
1.5 KiB
Go

package bash
import (
"path"
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/cli"
"github.com/shylinux/icebergs/base/web"
"github.com/shylinux/icebergs/core/code"
kit "github.com/shylinux/toolkits"
)
const BASH = "bash"
var Index = &ice.Context{Name: BASH, Help: "命令行",
Configs: map[string]*ice.Config{
BASH: {Name: BASH, Help: "命令行", Value: kit.Data(
kit.SSH_SOURCE, "http://mirrors.aliyun.com/gnu/bash/bash-4.2.53.tar.gz",
)},
},
Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }},
BASH: {Name: "bash port path auto start build download", Help: "命令行", Action: map[string]*ice.Action{
web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(code.INSTALL, web.DOWNLOAD, m.Conf(BASH, kit.META_SOURCE))
}},
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(code.INSTALL, cli.BUILD, m.Conf(BASH, kit.META_SOURCE))
}},
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(code.INSTALL, cli.START, m.Conf(BASH, kit.META_SOURCE), "bin/bash")
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Cmdy(code.INSTALL, path.Base(m.Conf(BASH, kit.META_SOURCE)), arg)
}},
},
}
func init() { code.Index.Register(Index, &web.Frame{}) }