mirror of
https://shylinux.com/x/icebergs
synced 2025-05-03 20:07:01 +08:00
add cli.ORDER
This commit is contained in:
parent
169888c834
commit
fc662053e3
@ -101,6 +101,7 @@ const (
|
|||||||
const (
|
const (
|
||||||
ERROR = "error"
|
ERROR = "error"
|
||||||
BUILD = "build"
|
BUILD = "build"
|
||||||
|
ORDER = "order"
|
||||||
SPAWN = "spawn"
|
SPAWN = "spawn"
|
||||||
CHECK = "check"
|
CHECK = "check"
|
||||||
BENCH = "bench"
|
BENCH = "bench"
|
||||||
|
@ -143,19 +143,8 @@ func _hash_inputs(m *ice.Message, prefix, chain string, field, value string) {
|
|||||||
m.SortIntR(kit.MDB_COUNT)
|
m.SortIntR(kit.MDB_COUNT)
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectAction(list map[string]*ice.Action, fields ...string) map[string]*ice.Action {
|
|
||||||
if len(fields) == 0 {
|
|
||||||
return list
|
|
||||||
}
|
|
||||||
|
|
||||||
res := map[string]*ice.Action{}
|
|
||||||
for _, field := range fields {
|
|
||||||
res[field] = list[field]
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
func HashAction(fields ...string) map[string]*ice.Action {
|
func HashAction(fields ...string) map[string]*ice.Action {
|
||||||
return selectAction(map[string]*ice.Action{
|
return ice.SelectAction(map[string]*ice.Action{
|
||||||
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(INSERT, m.PrefixKey(), "", HASH, arg)
|
m.Cmdy(INSERT, m.PrefixKey(), "", HASH, arg)
|
||||||
}},
|
}},
|
||||||
|
@ -133,7 +133,7 @@ func _list_inputs(m *ice.Message, prefix, chain string, field, value string) {
|
|||||||
const LIST = "list"
|
const LIST = "list"
|
||||||
|
|
||||||
func ListAction(fields ...string) map[string]*ice.Action {
|
func ListAction(fields ...string) map[string]*ice.Action {
|
||||||
return selectAction(map[string]*ice.Action{
|
return ice.SelectAction(map[string]*ice.Action{
|
||||||
INSERT: {Name: "insert type=go name=hi text=hello", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
INSERT: {Name: "insert type=go name=hi text=hello", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(INSERT, m.PrefixKey(), "", LIST, arg)
|
m.Cmdy(INSERT, m.PrefixKey(), "", LIST, arg)
|
||||||
}},
|
}},
|
||||||
|
@ -11,7 +11,7 @@ func ZoneAction(fields ...string) map[string]*ice.Action {
|
|||||||
_zone := func(m *ice.Message) string {
|
_zone := func(m *ice.Message) string {
|
||||||
return kit.Select(kit.MDB_ZONE, m.Conf(m.PrefixKey(), kit.Keym(kit.MDB_SHORT)))
|
return kit.Select(kit.MDB_ZONE, m.Conf(m.PrefixKey(), kit.Keym(kit.MDB_SHORT)))
|
||||||
}
|
}
|
||||||
return selectAction(map[string]*ice.Action{
|
return ice.SelectAction(map[string]*ice.Action{
|
||||||
CREATE: {Name: "create zone", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
CREATE: {Name: "create zone", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(INSERT, m.PrefixKey(), "", HASH, arg)
|
m.Cmdy(INSERT, m.PrefixKey(), "", HASH, arg)
|
||||||
}},
|
}},
|
||||||
|
@ -86,6 +86,10 @@ func _install_build(m *ice.Message, arg ...string) {
|
|||||||
m.Toast(ice.SUCCESS, cli.BUILD)
|
m.Toast(ice.SUCCESS, cli.BUILD)
|
||||||
m.ProcessHold()
|
m.ProcessHold()
|
||||||
}
|
}
|
||||||
|
func _install_order(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd(nfs.PUSH, "etc/path", kit.Path(m.Conf(INSTALL, kit.META_PATH), kit.TrimExt(m.Option(kit.MDB_LINK)), m.Option(kit.MDB_PATH)+"\n"))
|
||||||
|
m.Cmdy(nfs.CAT, "etc/path")
|
||||||
|
}
|
||||||
func _install_spawn(m *ice.Message, arg ...string) {
|
func _install_spawn(m *ice.Message, arg ...string) {
|
||||||
port := m.Cmdx(tcp.PORT, aaa.RIGHT)
|
port := m.Cmdx(tcp.PORT, aaa.RIGHT)
|
||||||
target := path.Join(m.Conf(cli.DAEMON, kit.META_PATH), port)
|
target := path.Join(m.Conf(cli.DAEMON, kit.META_PATH), port)
|
||||||
@ -145,12 +149,19 @@ func init() {
|
|||||||
cli.BUILD: {Name: "build link", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
cli.BUILD: {Name: "build link", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_install_build(m, arg...)
|
_install_build(m, arg...)
|
||||||
}},
|
}},
|
||||||
|
cli.ORDER: {Name: "order link path", Help: "加载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_install_order(m, arg...)
|
||||||
|
}},
|
||||||
cli.SPAWN: {Name: "spawn link", Help: "新建", Hand: func(m *ice.Message, arg ...string) {
|
cli.SPAWN: {Name: "spawn link", Help: "新建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_install_spawn(m, arg...)
|
_install_spawn(m, arg...)
|
||||||
}},
|
}},
|
||||||
cli.START: {Name: "start link cmd", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
cli.START: {Name: "start link cmd", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_install_start(m, arg...)
|
_install_start(m, arg...)
|
||||||
}},
|
}},
|
||||||
|
cli.SOURCE: {Name: "source link path", Help: "源码", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Option(nfs.DIR_ROOT, path.Join(m.Conf(INSTALL, kit.META_PATH), kit.TrimExt(m.Option(kit.MDB_LINK)), "_install"))
|
||||||
|
m.Cmdy(nfs.DIR, 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) {
|
||||||
switch len(arg) {
|
switch len(arg) {
|
||||||
case 0: // 源码列表
|
case 0: // 源码列表
|
||||||
@ -167,3 +178,17 @@ func init() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func InstallAction(fields ...string) map[string]*ice.Action {
|
||||||
|
return ice.SelectAction(map[string]*ice.Action{
|
||||||
|
web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(INSTALL, web.DOWNLOAD, m.Config(cli.SOURCE))
|
||||||
|
}},
|
||||||
|
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(INSTALL, cli.BUILD, m.Config(cli.SOURCE))
|
||||||
|
}},
|
||||||
|
cli.ORDER: {Name: "order", Help: "加载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd(INSTALL, cli.ORDER, m.Config(cli.SOURCE), "_install/bin")
|
||||||
|
}},
|
||||||
|
}, fields...)
|
||||||
|
}
|
||||||
|
16
misc.go
16
misc.go
@ -479,3 +479,19 @@ func (m *Message) AppendTrans(cb func(value string, key string, index int) strin
|
|||||||
func (m *Message) OptionUserWeb() *url.URL {
|
func (m *Message) OptionUserWeb() *url.URL {
|
||||||
return kit.ParseURL(m.Option(MSG_USERWEB))
|
return kit.ParseURL(m.Option(MSG_USERWEB))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Message) Config(key string) string {
|
||||||
|
return m.Conf(m.PrefixKey(), kit.Keym(key))
|
||||||
|
}
|
||||||
|
|
||||||
|
func SelectAction(list map[string]*Action, fields ...string) map[string]*Action {
|
||||||
|
if len(fields) == 0 {
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
res := map[string]*Action{}
|
||||||
|
for _, field := range fields {
|
||||||
|
res[field] = list[field]
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package bash
|
package bash
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
@ -12,30 +10,21 @@ import (
|
|||||||
|
|
||||||
const BASH = "bash"
|
const BASH = "bash"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: BASH, Help: "命令行",
|
var Index = &ice.Context{Name: BASH, Help: "命令行", Configs: map[string]*ice.Config{
|
||||||
Configs: map[string]*ice.Config{
|
|
||||||
BASH: {Name: BASH, Help: "命令行", Value: kit.Data(
|
BASH: {Name: BASH, Help: "命令行", Value: kit.Data(
|
||||||
cli.SOURCE, "http://mirrors.aliyun.com/gnu/bash/bash-4.4.18.tar.gz",
|
cli.SOURCE, "http://mirrors.tencent.com/macports/distfiles/bash/5.1_1/bash-5.1.tar.gz",
|
||||||
)},
|
)},
|
||||||
},
|
}, Commands: map[string]*ice.Command{
|
||||||
Commands: map[string]*ice.Command{
|
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
|
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() }},
|
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{
|
BASH: {Name: "bash path auto order build download", Help: "命令行", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
cli.ORDER: {Name: "order", Help: "加载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(code.INSTALL, web.DOWNLOAD, m.Conf(BASH, kit.Keym(cli.SOURCE)))
|
m.Cmd(code.INSTALL, cli.ORDER, m.Config(cli.SOURCE), "_install/bin")
|
||||||
}},
|
}},
|
||||||
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Cmdy(code.INSTALL, cli.BUILD, m.Conf(BASH, kit.Keym(cli.SOURCE)))
|
m.Cmdy(code.INSTALL, cli.SOURCE, m.Config(cli.SOURCE), arg)
|
||||||
}},
|
}},
|
||||||
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
}}
|
||||||
m.Cmdy(code.INSTALL, cli.START, m.Conf(BASH, kit.Keym(cli.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.Keym(cli.SOURCE))), arg)
|
|
||||||
}},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { code.Index.Register(Index, &web.Frame{}) }
|
func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||||
|
@ -7,15 +7,15 @@ refer `
|
|||||||
|
|
||||||
chapter "源码"
|
chapter "源码"
|
||||||
field "bash" web.code.bash.bash
|
field "bash" web.code.bash.bash
|
||||||
field "bash" web.code.inner args `usr/install/bash-4.4.18/ input.c 636`
|
field "bash" web.code.inner args `usr/install/bash-5.1/ input.c 636`
|
||||||
|
|
||||||
section "构建"
|
section "构建"
|
||||||
spark shell `
|
spark shell `
|
||||||
yum install -y wget make gcc
|
yum install -y wget make gcc
|
||||||
yum install -y byacc.x86_64
|
yum install -y byacc.x86_64
|
||||||
|
|
||||||
wget https://mirrors.aliyun.com/gnu/bash/bash-4.4.18.tar.gz
|
wget http://mirrors.tencent.com/macports/distfiles/bash/5.1_1/bash-5.1.tar.gz
|
||||||
tar xvf bash-4.4.18.tar.gz && cd bash-4.4.18
|
tar xvf bash-5.1.tar.gz && cd bash-5.1
|
||||||
|
|
||||||
./configure --prefix=$PWD/_install
|
./configure --prefix=$PWD/_install
|
||||||
make -j8 && make install
|
make -j8 && make install
|
||||||
@ -24,6 +24,7 @@ make -j8 && make install
|
|||||||
section "启动"
|
section "启动"
|
||||||
spark shell `
|
spark shell `
|
||||||
cd ./_install
|
cd ./_install
|
||||||
|
|
||||||
./bin/bash
|
./bin/bash
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package git
|
package git
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
@ -12,30 +10,23 @@ import (
|
|||||||
|
|
||||||
const GIT = "git"
|
const GIT = "git"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: GIT, Help: "代码库",
|
var Index = &ice.Context{Name: GIT, Help: "代码库", Configs: map[string]*ice.Config{
|
||||||
Configs: map[string]*ice.Config{
|
|
||||||
GIT: {Name: GIT, Help: "代码库", Value: kit.Data(
|
GIT: {Name: GIT, Help: "代码库", Value: kit.Data(
|
||||||
cli.SOURCE, "https://mirrors.edge.kernel.org/pub/software/scm/git/git-1.8.3.1.tar.gz",
|
cli.SOURCE, "http://mirrors.tencent.com/macports/distfiles/git-cinnabar/git-2.31.1.tar.gz",
|
||||||
)},
|
)},
|
||||||
},
|
}, Commands: map[string]*ice.Command{
|
||||||
Commands: map[string]*ice.Command{
|
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
|
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() }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }},
|
||||||
|
|
||||||
GIT: {Name: "git port path auto start build download", Help: "源代码", Action: map[string]*ice.Action{
|
GIT: {Name: "git path auto order build download", Help: "代码库", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
cli.ORDER: {Name: "order", Help: "加载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(code.INSTALL, web.DOWNLOAD, m.Conf(GIT, kit.Keym(cli.SOURCE)))
|
m.Cmd(code.INSTALL, cli.ORDER, m.Config(cli.SOURCE), "_install/bin")
|
||||||
|
m.Cmdy(code.INSTALL, cli.ORDER, m.Config(cli.SOURCE), "_install/libexec/git-core")
|
||||||
}},
|
}},
|
||||||
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Cmdy(code.INSTALL, cli.BUILD, m.Conf(GIT, kit.Keym(cli.SOURCE)))
|
m.Cmdy(code.INSTALL, cli.SOURCE, m.Config(cli.SOURCE), arg)
|
||||||
}},
|
}},
|
||||||
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
},
|
||||||
m.Cmdy(code.INSTALL, cli.START, m.Conf(GIT, kit.Keym(cli.SOURCE)), "bin/git")
|
|
||||||
}},
|
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
m.Cmdy(code.INSTALL, path.Base(m.Conf(GIT, kit.Keym(cli.SOURCE))), arg)
|
|
||||||
}},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { code.Index.Register(Index, &web.Frame{}) }
|
func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||||
|
@ -8,7 +8,7 @@ refer `
|
|||||||
|
|
||||||
chapter "源码"
|
chapter "源码"
|
||||||
field "安装" web.code.git.git
|
field "安装" web.code.git.git
|
||||||
field "源码" web.code.inner args `usr/install/git-1.8.3.1/ shell.c 145`
|
field "源码" web.code.inner args `usr/install/git-2.31.1/ shell.c 145`
|
||||||
|
|
||||||
section "构建"
|
section "构建"
|
||||||
spark shell `
|
spark shell `
|
||||||
@ -16,8 +16,8 @@ yum install -y wget make gcc
|
|||||||
yum install -y libcurl-devel.x86_64 openssl-devel.x86_64
|
yum install -y libcurl-devel.x86_64 openssl-devel.x86_64
|
||||||
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
|
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
|
||||||
|
|
||||||
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-1.8.3.1.tar.gz
|
wget http://mirrors.tencent.com/macports/distfiles/git-cinnabar/git-2.31.1.tar.gz
|
||||||
tar xvf git-1.8.3.1.tar.gz && cd git-1.8.3.1
|
tar xvf git-2.31.1.tar.gz && cd git-2.31.1
|
||||||
|
|
||||||
./configure --prefix=$PWD/_install
|
./configure --prefix=$PWD/_install
|
||||||
make -j8 && make install
|
make -j8 && make install
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package tmux
|
package tmux
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
@ -22,33 +20,24 @@ const (
|
|||||||
|
|
||||||
const TMUX = "tmux"
|
const TMUX = "tmux"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: TMUX, Help: "工作台",
|
var Index = &ice.Context{Name: TMUX, Help: "工作台", Configs: map[string]*ice.Config{
|
||||||
Configs: map[string]*ice.Config{
|
TMUX: {Name: TMUX, Help: "工作台", Value: kit.Data(
|
||||||
TMUX: {Name: TMUX, Help: "服务", Value: kit.Data(
|
cli.SOURCE, "http://mirrors.tencent.com/macports/distfiles/tmux/tmux-3.2.tar.gz",
|
||||||
cli.SOURCE, "https://github.com/tmux/tmux/releases/download/3.1b/tmux-3.1b.tar.gz",
|
|
||||||
)},
|
)},
|
||||||
},
|
}, Commands: map[string]*ice.Command{
|
||||||
Commands: map[string]*ice.Command{
|
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
|
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() }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }},
|
||||||
|
|
||||||
TMUX: {Name: "tmux port path auto start build download", Help: "服务", Action: map[string]*ice.Action{
|
TMUX: {Name: "tmux path auto start order build download", Help: "服务", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(code.INSTALL, web.DOWNLOAD, m.Conf(TMUX, kit.Keym(cli.SOURCE)))
|
|
||||||
}},
|
|
||||||
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(code.INSTALL, cli.BUILD, m.Conf(TMUX, kit.Keym(cli.SOURCE)))
|
|
||||||
}},
|
|
||||||
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Optionv(code.PREPARE, func(p string) []string {
|
m.Optionv(code.PREPARE, func(p string) []string {
|
||||||
return []string{"-S", kit.Path(m.Option(cli.CMD_DIR, p), "tmux.socket"), "new-session", "-dn", "miss"}
|
return []string{"-S", kit.Path(m.Option(cli.CMD_DIR, p), "tmux.socket"), "new-session", "-dn", "miss"}
|
||||||
})
|
})
|
||||||
m.Cmdy(code.INSTALL, cli.START, m.Conf(TMUX, kit.Keym(cli.SOURCE)), "bin/tmux")
|
m.Cmdy(code.INSTALL, cli.START, m.Config(cli.SOURCE), "bin/tmux")
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Cmdy(code.INSTALL, path.Base(m.Conf(TMUX, kit.Keym(cli.SOURCE))), arg)
|
m.Cmdy(code.INSTALL, cli.SOURCE, m.Config(cli.SOURCE), arg)
|
||||||
}},
|
}},
|
||||||
},
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
func init() { code.Index.Register(Index, &web.Frame{}) }
|
func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
title "tmux"
|
title "tmux"
|
||||||
refer `
|
refer `
|
||||||
官网 http://tmux.github.io/
|
官网 http://tmux.github.io/
|
||||||
文档 http://man.openbsd.org/OpenBSD-current/man1/tmux.1
|
|
||||||
源码 https://github.com/tmux/tmux
|
源码 https://github.com/tmux/tmux
|
||||||
|
文档 http://man.openbsd.org/OpenBSD-current/man1/tmux.1
|
||||||
`
|
`
|
||||||
|
|
||||||
chapter "源码"
|
chapter "源码"
|
||||||
field tmux web.code.tmux.tmux
|
field tmux web.code.tmux.tmux
|
||||||
field tmux web.code.inner args `usr/install/tmux-3.1b cmd-bind-key.c`
|
field tmux web.code.inner args `usr/install/tmux-3.2 cmd-bind-key.c`
|
||||||
|
|
||||||
section "构建"
|
section "构建"
|
||||||
spark shell `
|
spark shell `
|
||||||
yum install -y wget make gcc
|
yum install -y wget make gcc
|
||||||
yum install -y libevent-devel.x86_64 ncurses-devel.x86_64
|
yum install -y libevent-devel.x86_64 ncurses-devel.x86_64
|
||||||
|
|
||||||
wget https://github.com/tmux/tmux/releases/download/3.1b/tmux-3.1b.tar.gz
|
wget http://mirrors.tencent.com/macports/distfiles/tmux/tmux-3.2.tar.gz
|
||||||
tar xvf tmux-3.1b.tar.gz && cd tmux-3.1b
|
tar xvf tmux-3.2.tar.gz && cd tmux-3.2
|
||||||
|
|
||||||
./configure --prefix=$PWD/_install
|
./configure --prefix=$PWD/_install
|
||||||
make -j8 && make install
|
make -j8 && make install
|
||||||
@ -24,6 +24,7 @@ make -j8 && make install
|
|||||||
section "启动"
|
section "启动"
|
||||||
spark shell `
|
spark shell `
|
||||||
cd ./_install
|
cd ./_install
|
||||||
|
|
||||||
./bin/tmux -S $PWD/tmux.socket
|
./bin/tmux -S $PWD/tmux.socket
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package vim
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
@ -12,34 +13,29 @@ import (
|
|||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
func _vim_pkg(m *ice.Message) string {
|
func _vim_pkg(m *ice.Message, url string) string {
|
||||||
return kit.Replace(kit.TrimExt(m.Conf(VIM, kit.Keym(cli.BUILD))), "_.", "")
|
p := path.Join(m.Conf(code.INSTALL, kit.META_PATH), path.Base(url))
|
||||||
|
return kit.Path(m.Conf(code.INSTALL, kit.META_PATH), strings.Split(m.Cmdx(cli.SYSTEM, "sh", "-c", kit.Format("tar tf %s| head -n1", p)), "/")[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
const VIMRC = "vimrc"
|
const VIMRC = "vimrc"
|
||||||
const VIM = "vim"
|
const VIM = "vim"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: VIM, Help: "编辑器",
|
var Index = &ice.Context{Name: VIM, Help: "编辑器", Commands: map[string]*ice.Command{
|
||||||
Commands: map[string]*ice.Command{
|
VIM: {Name: "vim path auto order build download", Help: "编辑器", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
VIM: {Name: "vim 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(VIM, kit.Keym(cli.SOURCE)))
|
|
||||||
}},
|
|
||||||
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(code.INSTALL, cli.BUILD, _vim_pkg(m), m.Confv(VIM, kit.Keym(cli.BUILD)))
|
m.Cmdy(code.INSTALL, cli.BUILD, _vim_pkg(m, m.Config(cli.SOURCE)), "--enable-multibyte=yes",
|
||||||
}},
|
"--enable-pythoninterp=yes", "--enable-luainterp=yes", "--enable-cscope=yes")
|
||||||
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(code.INSTALL, cli.START, _vim_pkg(m), "bin/vim")
|
|
||||||
}},
|
}},
|
||||||
|
|
||||||
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(m.Conf(VIM, kit.Keym(code.PLUG)))
|
m.Echo(m.Config(code.PLUG))
|
||||||
}},
|
}},
|
||||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
|
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Cmdy(code.INSTALL, path.Base(m.Conf(VIM, kit.Keym(cli.SOURCE))), arg)
|
m.Cmdy(code.INSTALL, cli.SOURCE, _vim_pkg(m, m.Config(cli.SOURCE)), arg)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
@ -52,16 +48,9 @@ var Index = &ice.Context{Name: VIM, Help: "编辑器",
|
|||||||
m.Cmd(mdb.PLUGIN, mdb.CREATE, VIMRC, m.Prefix(VIM))
|
m.Cmd(mdb.PLUGIN, mdb.CREATE, VIMRC, m.Prefix(VIM))
|
||||||
m.Cmd(mdb.RENDER, mdb.CREATE, VIMRC, m.Prefix(VIM))
|
m.Cmd(mdb.RENDER, mdb.CREATE, VIMRC, m.Prefix(VIM))
|
||||||
}},
|
}},
|
||||||
},
|
}, Configs: map[string]*ice.Config{
|
||||||
Configs: map[string]*ice.Config{
|
|
||||||
VIM: {Name: VIM, Help: "编辑器", Value: kit.Data(
|
VIM: {Name: VIM, Help: "编辑器", Value: kit.Data(
|
||||||
cli.SOURCE, "http://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2",
|
cli.SOURCE, "http://mirrors.tencent.com/macports/distfiles/vim/vim-8.2.2681.tar.gz",
|
||||||
cli.BUILD, []interface{}{
|
|
||||||
"--enable-multibyte=yes",
|
|
||||||
"--enable-pythoninterp=yes",
|
|
||||||
"--enable-luainterp=yes",
|
|
||||||
"--enable-cscope=yes",
|
|
||||||
},
|
|
||||||
|
|
||||||
code.PLUG, kit.Dict(
|
code.PLUG, kit.Dict(
|
||||||
code.SPLIT, kit.Dict(
|
code.SPLIT, kit.Dict(
|
||||||
@ -91,7 +80,6 @@ var Index = &ice.Context{Name: VIM, Help: "编辑器",
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)},
|
)},
|
||||||
},
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
func init() { code.Index.Register(Index, &web.Frame{}) }
|
func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||||
|
@ -7,23 +7,24 @@ refer `
|
|||||||
|
|
||||||
chapter "源码"
|
chapter "源码"
|
||||||
field "安装" web.code.vim.vim
|
field "安装" web.code.vim.vim
|
||||||
field "源码" web.code.inner args `usr/install/vim81/ src/main.c 110`
|
field "源码" web.code.inner args `usr/install/vim-vim-12be734/ src/main.c 110`
|
||||||
|
|
||||||
section "构建"
|
section "构建"
|
||||||
spark shell `
|
spark shell `
|
||||||
yum install -y wget make gcc
|
yum install -y wget make gcc
|
||||||
yum install -y ncurses-devel.x86_64 bzip2.x86_64
|
yum install -y ncurses-devel.x86_64 bzip2.x86_64
|
||||||
|
|
||||||
wget ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
|
wget http://mirrors.tencent.com/macports/distfiles/vim/vim-8.2.2681.tar.gz
|
||||||
tar xvf vim-8.1.tar.bz2 && cd vim81
|
tar xvf vim-8.2.2681.tar.gz && cd vim-vim-12be734
|
||||||
|
|
||||||
./configure --prefix=$PWD/_install --enable-multibyte=yes
|
./configure --prefix=$PWD/_install --enable-multibyte=yes
|
||||||
make -j4 && make install
|
make -j8 && make install
|
||||||
`
|
`
|
||||||
|
|
||||||
section "启动"
|
section "启动"
|
||||||
spark shell `
|
spark shell `
|
||||||
cd ./_install
|
cd ./_install
|
||||||
|
|
||||||
./bin/vim
|
./bin/vim
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -32,7 +33,6 @@ field "编辑器" web.code.vim.sess
|
|||||||
field "同步流" web.code.vim.sync
|
field "同步流" web.code.vim.sync
|
||||||
field "收藏夹" web.code.vim.favor
|
field "收藏夹" web.code.vim.favor
|
||||||
field "输入法" web.code.vim.input
|
field "输入法" web.code.vim.input
|
||||||
return
|
|
||||||
|
|
||||||
chapter "插件"
|
chapter "插件"
|
||||||
field "插件管理器" web.code.inner args `usr/intshell/misc/vim/ plug.vim`
|
field "插件管理器" web.code.inner args `usr/intshell/misc/vim/ plug.vim`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user