mirror of
https://shylinux.com/x/icebergs
synced 2025-05-02 19:47:02 +08:00
add cli.ORDER
This commit is contained in:
parent
169888c834
commit
fc662053e3
@ -101,6 +101,7 @@ const (
|
||||
const (
|
||||
ERROR = "error"
|
||||
BUILD = "build"
|
||||
ORDER = "order"
|
||||
SPAWN = "spawn"
|
||||
CHECK = "check"
|
||||
BENCH = "bench"
|
||||
|
@ -143,19 +143,8 @@ func _hash_inputs(m *ice.Message, prefix, chain string, field, value string) {
|
||||
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 {
|
||||
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) {
|
||||
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"
|
||||
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
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.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) {
|
||||
port := m.Cmdx(tcp.PORT, aaa.RIGHT)
|
||||
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) {
|
||||
_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) {
|
||||
_install_spawn(m, arg...)
|
||||
}},
|
||||
cli.START: {Name: "start link cmd", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||
_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) {
|
||||
switch len(arg) {
|
||||
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 {
|
||||
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
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
@ -12,30 +10,21 @@ import (
|
||||
|
||||
const BASH = "bash"
|
||||
|
||||
var Index = &ice.Context{Name: BASH, Help: "命令行",
|
||||
Configs: map[string]*ice.Config{
|
||||
BASH: {Name: BASH, Help: "命令行", Value: kit.Data(
|
||||
cli.SOURCE, "http://mirrors.aliyun.com/gnu/bash/bash-4.4.18.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() }},
|
||||
var Index = &ice.Context{Name: BASH, Help: "命令行", Configs: map[string]*ice.Config{
|
||||
BASH: {Name: BASH, Help: "命令行", Value: kit.Data(
|
||||
cli.SOURCE, "http://mirrors.tencent.com/macports/distfiles/bash/5.1_1/bash-5.1.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.Keym(cli.SOURCE)))
|
||||
}},
|
||||
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, cli.BUILD, m.Conf(BASH, kit.Keym(cli.SOURCE)))
|
||||
}},
|
||||
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)
|
||||
BASH: {Name: "bash path auto order build download", Help: "命令行", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
cli.ORDER: {Name: "order", Help: "加载", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(code.INSTALL, cli.ORDER, m.Config(cli.SOURCE), "_install/bin")
|
||||
}},
|
||||
},
|
||||
}
|
||||
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, cli.SOURCE, m.Config(cli.SOURCE), arg)
|
||||
}},
|
||||
}}
|
||||
|
||||
func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||
|
@ -7,15 +7,15 @@ refer `
|
||||
|
||||
chapter "源码"
|
||||
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 "构建"
|
||||
spark shell `
|
||||
yum install -y wget make gcc
|
||||
yum install -y byacc.x86_64
|
||||
|
||||
wget https://mirrors.aliyun.com/gnu/bash/bash-4.4.18.tar.gz
|
||||
tar xvf bash-4.4.18.tar.gz && cd bash-4.4.18
|
||||
wget http://mirrors.tencent.com/macports/distfiles/bash/5.1_1/bash-5.1.tar.gz
|
||||
tar xvf bash-5.1.tar.gz && cd bash-5.1
|
||||
|
||||
./configure --prefix=$PWD/_install
|
||||
make -j8 && make install
|
||||
@ -24,6 +24,7 @@ make -j8 && make install
|
||||
section "启动"
|
||||
spark shell `
|
||||
cd ./_install
|
||||
|
||||
./bin/bash
|
||||
`
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
@ -12,30 +10,23 @@ import (
|
||||
|
||||
const GIT = "git"
|
||||
|
||||
var Index = &ice.Context{Name: GIT, Help: "代码库",
|
||||
Configs: map[string]*ice.Config{
|
||||
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",
|
||||
)},
|
||||
},
|
||||
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() }},
|
||||
var Index = &ice.Context{Name: GIT, Help: "代码库", Configs: map[string]*ice.Config{
|
||||
GIT: {Name: GIT, Help: "代码库", Value: kit.Data(
|
||||
cli.SOURCE, "http://mirrors.tencent.com/macports/distfiles/git-cinnabar/git-2.31.1.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() }},
|
||||
|
||||
GIT: {Name: "git 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(GIT, kit.Keym(cli.SOURCE)))
|
||||
}},
|
||||
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, cli.BUILD, m.Conf(GIT, kit.Keym(cli.SOURCE)))
|
||||
}},
|
||||
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)
|
||||
GIT: {Name: "git path auto order build download", Help: "代码库", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
cli.ORDER: {Name: "order", Help: "加载", Hand: func(m *ice.Message, arg ...string) {
|
||||
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")
|
||||
}},
|
||||
},
|
||||
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, cli.SOURCE, m.Config(cli.SOURCE), arg)
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||
|
@ -8,7 +8,7 @@ refer `
|
||||
|
||||
chapter "源码"
|
||||
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 "构建"
|
||||
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 perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
|
||||
|
||||
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-1.8.3.1.tar.gz
|
||||
tar xvf git-1.8.3.1.tar.gz && cd git-1.8.3.1
|
||||
wget http://mirrors.tencent.com/macports/distfiles/git-cinnabar/git-2.31.1.tar.gz
|
||||
tar xvf git-2.31.1.tar.gz && cd git-2.31.1
|
||||
|
||||
./configure --prefix=$PWD/_install
|
||||
make -j8 && make install
|
||||
|
@ -1,8 +1,6 @@
|
||||
package tmux
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
@ -22,33 +20,24 @@ const (
|
||||
|
||||
const TMUX = "tmux"
|
||||
|
||||
var Index = &ice.Context{Name: TMUX, Help: "工作台",
|
||||
Configs: map[string]*ice.Config{
|
||||
TMUX: {Name: TMUX, Help: "服务", Value: kit.Data(
|
||||
cli.SOURCE, "https://github.com/tmux/tmux/releases/download/3.1b/tmux-3.1b.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() }},
|
||||
var Index = &ice.Context{Name: TMUX, Help: "工作台", Configs: map[string]*ice.Config{
|
||||
TMUX: {Name: TMUX, Help: "工作台", Value: kit.Data(
|
||||
cli.SOURCE, "http://mirrors.tencent.com/macports/distfiles/tmux/tmux-3.2.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() }},
|
||||
|
||||
TMUX: {Name: "tmux 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(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) {
|
||||
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"}
|
||||
})
|
||||
m.Cmdy(code.INSTALL, cli.START, m.Conf(TMUX, kit.Keym(cli.SOURCE)), "bin/tmux")
|
||||
}},
|
||||
}, 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)
|
||||
TMUX: {Name: "tmux path auto start order build download", Help: "服务", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...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"}
|
||||
})
|
||||
m.Cmdy(code.INSTALL, cli.START, m.Config(cli.SOURCE), "bin/tmux")
|
||||
}},
|
||||
},
|
||||
}
|
||||
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, cli.SOURCE, m.Config(cli.SOURCE), arg)
|
||||
}},
|
||||
}}
|
||||
|
||||
func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||
|
@ -1,21 +1,21 @@
|
||||
title "tmux"
|
||||
refer `
|
||||
官网 http://tmux.github.io/
|
||||
文档 http://man.openbsd.org/OpenBSD-current/man1/tmux.1
|
||||
源码 https://github.com/tmux/tmux
|
||||
文档 http://man.openbsd.org/OpenBSD-current/man1/tmux.1
|
||||
`
|
||||
|
||||
chapter "源码"
|
||||
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 "构建"
|
||||
spark shell `
|
||||
yum install -y wget make gcc
|
||||
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
|
||||
tar xvf tmux-3.1b.tar.gz && cd tmux-3.1b
|
||||
wget http://mirrors.tencent.com/macports/distfiles/tmux/tmux-3.2.tar.gz
|
||||
tar xvf tmux-3.2.tar.gz && cd tmux-3.2
|
||||
|
||||
./configure --prefix=$PWD/_install
|
||||
make -j8 && make install
|
||||
@ -24,6 +24,7 @@ make -j8 && make install
|
||||
section "启动"
|
||||
spark shell `
|
||||
cd ./_install
|
||||
|
||||
./bin/tmux -S $PWD/tmux.socket
|
||||
`
|
||||
|
||||
|
124
misc/vim/vim.go
124
misc/vim/vim.go
@ -2,6 +2,7 @@ package vim
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
@ -12,86 +13,73 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _vim_pkg(m *ice.Message) string {
|
||||
return kit.Replace(kit.TrimExt(m.Conf(VIM, kit.Keym(cli.BUILD))), "_.", "")
|
||||
func _vim_pkg(m *ice.Message, url string) string {
|
||||
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 VIM = "vim"
|
||||
|
||||
var Index = &ice.Context{Name: VIM, Help: "编辑器",
|
||||
Commands: map[string]*ice.Command{
|
||||
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) {
|
||||
m.Cmdy(code.INSTALL, cli.BUILD, _vim_pkg(m), m.Confv(VIM, kit.Keym(cli.BUILD)))
|
||||
}},
|
||||
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) {
|
||||
m.Echo(m.Conf(VIM, kit.Keym(code.PLUG)))
|
||||
}},
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
|
||||
}},
|
||||
}, 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)
|
||||
var Index = &ice.Context{Name: VIM, Help: "编辑器", Commands: map[string]*ice.Command{
|
||||
VIM: {Name: "vim path auto order build download", Help: "编辑器", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||
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")
|
||||
}},
|
||||
|
||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Save()
|
||||
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(m.Config(code.PLUG))
|
||||
}},
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Load()
|
||||
m.Cmd(mdb.PLUGIN, mdb.CREATE, VIM, m.Prefix(VIM))
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, VIM, m.Prefix(VIM))
|
||||
m.Cmd(mdb.PLUGIN, mdb.CREATE, VIMRC, m.Prefix(VIM))
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, VIMRC, m.Prefix(VIM))
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
|
||||
}},
|
||||
},
|
||||
Configs: map[string]*ice.Config{
|
||||
VIM: {Name: VIM, Help: "编辑器", Value: kit.Data(
|
||||
cli.SOURCE, "http://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2",
|
||||
cli.BUILD, []interface{}{
|
||||
"--enable-multibyte=yes",
|
||||
"--enable-pythoninterp=yes",
|
||||
"--enable-luainterp=yes",
|
||||
"--enable-cscope=yes",
|
||||
},
|
||||
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, cli.SOURCE, _vim_pkg(m, m.Config(cli.SOURCE)), arg)
|
||||
}},
|
||||
|
||||
code.PLUG, kit.Dict(
|
||||
code.SPLIT, kit.Dict(
|
||||
"space", " \t",
|
||||
"operator", "{[(&.,;!|<>)]}",
|
||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Save()
|
||||
}},
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Load()
|
||||
m.Cmd(mdb.PLUGIN, mdb.CREATE, VIM, m.Prefix(VIM))
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, VIM, m.Prefix(VIM))
|
||||
m.Cmd(mdb.PLUGIN, mdb.CREATE, VIMRC, m.Prefix(VIM))
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, VIMRC, m.Prefix(VIM))
|
||||
}},
|
||||
}, Configs: map[string]*ice.Config{
|
||||
VIM: {Name: VIM, Help: "编辑器", Value: kit.Data(
|
||||
cli.SOURCE, "http://mirrors.tencent.com/macports/distfiles/vim/vim-8.2.2681.tar.gz",
|
||||
|
||||
code.PLUG, kit.Dict(
|
||||
code.SPLIT, kit.Dict(
|
||||
"space", " \t",
|
||||
"operator", "{[(&.,;!|<>)]}",
|
||||
),
|
||||
code.PREFIX, kit.Dict(
|
||||
"\"", "comment",
|
||||
),
|
||||
code.PREPARE, kit.Dict(
|
||||
code.KEYWORD, kit.Simple(
|
||||
"source", "finish",
|
||||
"set", "let", "end",
|
||||
"if", "else", "elseif", "endif",
|
||||
"for", "in", "continue", "break", "endfor",
|
||||
"try", "catch", "finally", "endtry",
|
||||
"call", "function", "return", "endfunction",
|
||||
|
||||
"autocmd", "command", "execute",
|
||||
"nnoremap", "cnoremap", "inoremap",
|
||||
"colorscheme", "highlight", "syntax",
|
||||
),
|
||||
code.PREFIX, kit.Dict(
|
||||
"\"", "comment",
|
||||
),
|
||||
code.PREPARE, kit.Dict(
|
||||
code.KEYWORD, kit.Simple(
|
||||
"source", "finish",
|
||||
"set", "let", "end",
|
||||
"if", "else", "elseif", "endif",
|
||||
"for", "in", "continue", "break", "endfor",
|
||||
"try", "catch", "finally", "endtry",
|
||||
"call", "function", "return", "endfunction",
|
||||
|
||||
"autocmd", "command", "execute",
|
||||
"nnoremap", "cnoremap", "inoremap",
|
||||
"colorscheme", "highlight", "syntax",
|
||||
),
|
||||
code.FUNCTION, kit.Simple(
|
||||
"has", "type", "empty",
|
||||
"exists", "executable",
|
||||
),
|
||||
code.FUNCTION, kit.Simple(
|
||||
"has", "type", "empty",
|
||||
"exists", "executable",
|
||||
),
|
||||
),
|
||||
)},
|
||||
},
|
||||
}
|
||||
),
|
||||
)},
|
||||
}}
|
||||
|
||||
func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||
|
@ -7,23 +7,24 @@ refer `
|
||||
|
||||
chapter "源码"
|
||||
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 "构建"
|
||||
spark shell `
|
||||
yum install -y wget make gcc
|
||||
yum install -y ncurses-devel.x86_64 bzip2.x86_64
|
||||
|
||||
wget ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
|
||||
tar xvf vim-8.1.tar.bz2 && cd vim81
|
||||
wget http://mirrors.tencent.com/macports/distfiles/vim/vim-8.2.2681.tar.gz
|
||||
tar xvf vim-8.2.2681.tar.gz && cd vim-vim-12be734
|
||||
|
||||
./configure --prefix=$PWD/_install --enable-multibyte=yes
|
||||
make -j4 && make install
|
||||
make -j8 && make install
|
||||
`
|
||||
|
||||
section "启动"
|
||||
spark shell `
|
||||
cd ./_install
|
||||
|
||||
./bin/vim
|
||||
`
|
||||
|
||||
@ -32,7 +33,6 @@ field "编辑器" web.code.vim.sess
|
||||
field "同步流" web.code.vim.sync
|
||||
field "收藏夹" web.code.vim.favor
|
||||
field "输入法" web.code.vim.input
|
||||
return
|
||||
|
||||
chapter "插件"
|
||||
field "插件管理器" web.code.inner args `usr/intshell/misc/vim/ plug.vim`
|
||||
|
Loading…
x
Reference in New Issue
Block a user