mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
opt some
This commit is contained in:
parent
f9eeef862c
commit
68762a99f5
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/shylinux/icebergs/base/cli"
|
"github.com/shylinux/icebergs/base/cli"
|
||||||
"github.com/shylinux/icebergs/base/gdb"
|
"github.com/shylinux/icebergs/base/gdb"
|
||||||
"github.com/shylinux/icebergs/base/mdb"
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
|
"github.com/shylinux/icebergs/base/tcp"
|
||||||
"github.com/shylinux/icebergs/base/web"
|
"github.com/shylinux/icebergs/base/web"
|
||||||
"github.com/shylinux/icebergs/core/code"
|
"github.com/shylinux/icebergs/core/code"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
@ -32,6 +33,9 @@ var _tmux = []string{cli.SYSTEM, 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(
|
||||||
|
"source", "https://github.com/tmux/tmux/releases/download/3.1b/tmux-3.1b.tar.gz",
|
||||||
|
)},
|
||||||
SESSION: {Name: "session", Help: "会话", Value: kit.Data(
|
SESSION: {Name: "session", Help: "会话", Value: kit.Data(
|
||||||
"format", "#{session_id},#{session_attached},#{session_name},#{session_windows},#{session_height},#{session_width}",
|
"format", "#{session_id},#{session_attached},#{session_name},#{session_windows},#{session_height},#{session_width}",
|
||||||
"fields", "id,tag,session,windows,height,width",
|
"fields", "id,tag,session,windows,height,width",
|
||||||
@ -55,6 +59,59 @@ var Index = &ice.Context{Name: TMUX, Help: "工作台",
|
|||||||
)},
|
)},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
|
TMUX: {Name: "tmux 启动:button 编译:button 下载:button", Help: "终端", Action: map[string]*ice.Action{
|
||||||
|
"download": {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(code.INSTALL, "download", m.Conf(TMUX, "meta.source"))
|
||||||
|
}},
|
||||||
|
"compile": {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
name := path.Base(strings.TrimSuffix(strings.TrimSuffix(m.Conf(TMUX, "meta.source"), ".tar.gz"), "zip"))
|
||||||
|
p := m.Option(cli.CMD_DIR, path.Join(m.Conf(code.INSTALL, kit.META_PATH), name))
|
||||||
|
m.Cmdy(cli.SYSTEM, "./configure", "--prefix="+kit.Path(path.Join(p, "install")))
|
||||||
|
m.Cmdy(cli.SYSTEM, "make", "-j8")
|
||||||
|
}},
|
||||||
|
"start": {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
// 分配
|
||||||
|
port, p := "", ""
|
||||||
|
for {
|
||||||
|
port = m.Cmdx(tcp.PORT, "select", port)
|
||||||
|
p = path.Join(m.Conf(cli.DAEMON, kit.META_PATH), port)
|
||||||
|
if _, e := os.Stat(p); e != nil && os.IsNotExist(e) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
port = kit.Format(kit.Int(port) + 1)
|
||||||
|
}
|
||||||
|
os.MkdirAll(path.Join(p, "logs"), ice.MOD_DIR)
|
||||||
|
os.MkdirAll(path.Join(p, "bin"), ice.MOD_DIR)
|
||||||
|
os.MkdirAll(p, ice.MOD_DIR)
|
||||||
|
|
||||||
|
// 复制
|
||||||
|
name := path.Base(strings.TrimSuffix(strings.TrimSuffix(m.Conf(TMUX, "meta.source"), ".tar.gz"), "zip"))
|
||||||
|
m.Cmd(cli.SYSTEM, "cp", "-r", path.Join(m.Conf(code.INSTALL, kit.META_PATH), name, "src/redis-cli"), path.Join(p, "bin"))
|
||||||
|
m.Cmd(cli.SYSTEM, "cp", "-r", path.Join(m.Conf(code.INSTALL, kit.META_PATH), name, "src/redis-server"), path.Join(p, "bin"))
|
||||||
|
m.Cmd(cli.SYSTEM, "cp", "-r", path.Join(m.Conf(code.INSTALL, kit.META_PATH), name, "src/redis-benchmark"), path.Join(p, "bin"))
|
||||||
|
|
||||||
|
// 启动
|
||||||
|
m.Option(cli.CMD_DIR, p)
|
||||||
|
m.Cmdy(cli.DAEMON, "bin/redis-server", "--port", port)
|
||||||
|
}},
|
||||||
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
if len(arg) > 0 && arg[0] != "" {
|
||||||
|
m.Cmdy(cli.SYSTEM, "bin/redis-cli", "-p", arg[0], kit.Split(kit.Select("info", arg, 1)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
m.Cmd(cli.DAEMON).Table(func(index int, value map[string]string, head []string) {
|
||||||
|
if strings.HasPrefix(value[kit.MDB_NAME], "bin/redis") {
|
||||||
|
m.Push(kit.MDB_TIME, value[kit.MDB_TIME])
|
||||||
|
m.Push(kit.MDB_PORT, path.Base(value[kit.MDB_DIR]))
|
||||||
|
m.Push(kit.MDB_DIR, value[kit.MDB_DIR])
|
||||||
|
m.Push(kit.MDB_STATUS, value[kit.MDB_STATUS])
|
||||||
|
m.Push(kit.MDB_PID, value[kit.MDB_PID])
|
||||||
|
m.Push(kit.MDB_NAME, value[kit.MDB_NAME])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
m.Sort("time", "time_r")
|
||||||
|
}},
|
||||||
TEXT: {Name: "text 保存:button 清空:button text:textarea", Help: "文本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
TEXT: {Name: "text 保存:button 清空:button text:textarea", Help: "文本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] != "" {
|
if len(arg) > 0 && arg[0] != "" {
|
||||||
m.Cmd(_tmux, "set-buffer", arg[0])
|
m.Cmd(_tmux, "set-buffer", arg[0])
|
||||||
@ -62,11 +119,7 @@ var Index = &ice.Context{Name: TMUX, Help: "工作台",
|
|||||||
|
|
||||||
text := m.Cmdx(_tmux, "show-buffer")
|
text := m.Cmdx(_tmux, "show-buffer")
|
||||||
m.Cmdy("web.wiki.image", "qrcode", text)
|
m.Cmdy("web.wiki.image", "qrcode", text)
|
||||||
|
m.Echo("\n<span>%s</span>", text).Render("")
|
||||||
m.Echo("\n")
|
|
||||||
m.Echo(text)
|
|
||||||
m.Echo("\n")
|
|
||||||
m.Render("")
|
|
||||||
}},
|
}},
|
||||||
BUFFER: {Name: "buffer [buffer=auto [value]] auto", Help: "缓存", Action: map[string]*ice.Action{
|
BUFFER: {Name: "buffer [buffer=auto [value]] auto", Help: "缓存", Action: map[string]*ice.Action{
|
||||||
mdb.MODIFY: {Name: "modify", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
mdb.MODIFY: {Name: "modify", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -1,9 +1,30 @@
|
|||||||
title "tmux"
|
title "tmux"
|
||||||
|
|
||||||
refer "官网" `
|
refer "官网" `
|
||||||
官网 http://tmux.github.io/
|
官网 http://tmux.github.io/
|
||||||
文档 https://git-scm.com/docs
|
|
||||||
源码 https://github.com/tmux/tmux
|
源码 https://github.com/tmux/tmux
|
||||||
|
文档 http://man.openbsd.org/OpenBSD-current/man1/tmux.1
|
||||||
|
`
|
||||||
|
premenu
|
||||||
|
|
||||||
|
field tmux web.code.tmux.tmux
|
||||||
|
field tmux web.code.inner args `[ usr/install/tmux-3.1b input.c ]`
|
||||||
|
|
||||||
|
chapter "安装"
|
||||||
|
section "libevent"
|
||||||
|
spark shell `
|
||||||
|
wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
|
||||||
|
tar xvf libevent-2.1.12-stable.tar.gz && cd libevent-2.1.12-stable
|
||||||
|
./configure
|
||||||
|
make -j8
|
||||||
|
make install
|
||||||
|
`
|
||||||
|
section "ncureses"
|
||||||
|
spark shell `
|
||||||
|
wget https://invisible-island.net/datafiles/release/ncurses.tar.gz
|
||||||
|
tar xvf ncurese.tar.gz && cd ncurese-6.2
|
||||||
|
./configure
|
||||||
|
make -j8
|
||||||
|
make install
|
||||||
`
|
`
|
||||||
chapter "应用"
|
chapter "应用"
|
||||||
field text web.code.tmux.text
|
field text web.code.tmux.text
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
title "vim"
|
title "vim"
|
||||||
|
|
||||||
premenu
|
|
||||||
refer "官网" `
|
refer "官网" `
|
||||||
官网 https://www.vim.org
|
官网 https://www.vim.org
|
||||||
源码 https://github.com/vim/vim
|
源码 https://github.com/vim/vim
|
||||||
文档 http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
|
文档 http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
|
||||||
`
|
`
|
||||||
|
premenu
|
||||||
|
|
||||||
chapter "安装"
|
chapter "安装"
|
||||||
section "下载源码"
|
|
||||||
refer `
|
|
||||||
下载 ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
|
|
||||||
`
|
|
||||||
|
|
||||||
section "编译安装"
|
section "编译安装"
|
||||||
spark shell `
|
spark shell `
|
||||||
|
wget ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
|
||||||
tar xvf vim-81.tar.bz2 && cd vim81
|
tar xvf vim-81.tar.bz2 && cd vim81
|
||||||
./configure --prefix=/usr/local --enable-multibyte=yes
|
./configure --prefix=/usr/local --enable-multibyte=yes
|
||||||
make -j4
|
make -j4
|
||||||
@ -31,6 +26,7 @@ field "源码" web.code.inner args `[ usr/install/vim81/ src/main.c 110 ]`
|
|||||||
field "脚本" web.code.inner args `[ usr/local/share/vim/vim81/ filetype.vim ]`
|
field "脚本" web.code.inner args `[ usr/local/share/vim/vim81/ filetype.vim ]`
|
||||||
field "文档" web.code.inner args `[ usr/local/share/vim/vim81/doc/ help.txt ]`
|
field "文档" web.code.inner args `[ usr/local/share/vim/vim81/doc/ help.txt ]`
|
||||||
|
|
||||||
|
|
||||||
chapter "使用"
|
chapter "使用"
|
||||||
|
|
||||||
chapter "配置"
|
chapter "配置"
|
||||||
|
@ -1 +1,6 @@
|
|||||||
title "zsh"
|
title "zsh"
|
||||||
|
refer `
|
||||||
|
官网 https://www.zsh.org/
|
||||||
|
源码 https://github.com/zsh-users/zsh/
|
||||||
|
文档 http://zsh.sourceforge.net/Doc/Release/zsh_toc.html
|
||||||
|
`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user