forked from x/icebergs
add tmux.make
This commit is contained in:
parent
8c7ac5d978
commit
3eaa88d7a6
@ -943,6 +943,13 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
|
|||||||
p := path.Join(m.Conf(ice.WEB_DREAM, "meta.path"), arg[0])
|
p := path.Join(m.Conf(ice.WEB_DREAM, "meta.path"), arg[0])
|
||||||
os.MkdirAll(p, 0777)
|
os.MkdirAll(p, 0777)
|
||||||
|
|
||||||
|
if b, e := ioutil.ReadFile(path.Join(p, m.Conf(ice.GDB_SIGNAL, "meta.pid"))); e == nil {
|
||||||
|
if s, e := os.Stat("/proc/" + string(b)); e == nil && s.IsDir() {
|
||||||
|
m.Info("already exists %v", string(b))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if m.Richs(ice.WEB_SPACE, nil, arg[0], nil) == nil {
|
if m.Richs(ice.WEB_SPACE, nil, arg[0], nil) == nil {
|
||||||
// 启动任务
|
// 启动任务
|
||||||
m.Option("cmd_dir", p)
|
m.Option("cmd_dir", p)
|
||||||
|
@ -4,7 +4,7 @@ var title = `<{{.Option "level"}} class="story" data-type="{{.Option "type"}}" d
|
|||||||
var brief = `<p class="story" data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">{{.Option "text"}}</p>`
|
var brief = `<p class="story" data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">{{.Option "text"}}</p>`
|
||||||
var refer = `<ul class="story"
|
var refer = `<ul class="story"
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
||||||
{{range $index, $value := .Optionv "list"}}<li>{{index $value 0}}: {{index $value 1}}</li>{{end}}</ul>`
|
{{range $index, $value := .Optionv "list"}}<li>{{index $value 0}}: <a href="{{index $value 1}}" target="_blank">{{index $value 1}}</a></li>{{end}}</ul>`
|
||||||
var spark = `<p class="story" data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">{{.Option "text"}}</p>`
|
var spark = `<p class="story" data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">{{.Option "text"}}</p>`
|
||||||
|
|
||||||
var local = `<div class="story"
|
var local = `<div class="story"
|
||||||
|
2
go.sum
2
go.sum
@ -1,4 +1,6 @@
|
|||||||
|
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
|
||||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/shylinux/toolkits v0.1.4 h1:GW7rRFOSww56x+rUfH0/tho3+FaErxz5+5RwlA8oWnk=
|
github.com/shylinux/toolkits v0.1.4 h1:GW7rRFOSww56x+rUfH0/tho3+FaErxz5+5RwlA8oWnk=
|
||||||
github.com/shylinux/toolkits v0.1.4/go.mod h1:Y68Ot6xOmo1bun67YvqC3chDGeU2gDxtsUnvVDGJm4g=
|
github.com/shylinux/toolkits v0.1.4/go.mod h1:Y68Ot6xOmo1bun67YvqC3chDGeU2gDxtsUnvVDGJm4g=
|
||||||
|
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086 h1:RYiqpb2ii2Z6J4x0wxK46kvPBbFuZcdhS+CIztmYgZs=
|
||||||
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
|
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
|
||||||
|
@ -43,6 +43,8 @@ var Index = &ice.Context{Name: "tmux", Help: "工作台",
|
|||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
ice.CODE_INSTALL: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
ice.CODE_INSTALL: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
m.Option("cmd_dir", m.Conf("install", "meta.path"))
|
||||||
|
m.Cmd(ice.CLI_SYSTEM, "git", "clone", "https://github.com/tmux/tmux")
|
||||||
}},
|
}},
|
||||||
ice.CODE_PREPARE: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
ice.CODE_PREPARE: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Cmd("nfs.link", path.Join(os.Getenv("HOME"), ".tmux.conf"), "etc/conf/tmux.conf")
|
m.Cmd("nfs.link", path.Join(os.Getenv("HOME"), ".tmux.conf"), "etc/conf/tmux.conf")
|
||||||
@ -82,17 +84,20 @@ var Index = &ice.Context{Name: "tmux", Help: "工作台",
|
|||||||
m.Option("cmd_env", "TMUX", "", "ctx_dev", dev, "ctx_share", share)
|
m.Option("cmd_env", "TMUX", "", "ctx_dev", dev, "ctx_share", share)
|
||||||
m.Option("cmd_dir", path.Join(m.Conf(ice.WEB_DREAM, "meta.path"), arg[0]))
|
m.Option("cmd_dir", path.Join(m.Conf(ice.WEB_DREAM, "meta.path"), arg[0]))
|
||||||
|
|
||||||
if arg[0] != "" && m.Cmd(prefix, "has-session", "-t", arg[0]).Append("code") != "0" {
|
if arg[0] != "" && m.Cmd(prefix, "has-session", "-t", arg[0]).Append("code") == "0" {
|
||||||
// 创建会话
|
// 复用会话
|
||||||
m.Cmd(prefix, "new-session", "-ds", arg[0])
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 创建会话
|
||||||
|
m.Cmd(prefix, "new-session", "-ds", arg[0])
|
||||||
|
|
||||||
if m.Option("local") != "" {
|
if m.Option("local") != "" {
|
||||||
// 自动虚拟
|
// 创建容器
|
||||||
m.Cmd("local", m.Option("local"), arg[0])
|
m.Cmd("local", m.Option("local"), arg[0])
|
||||||
}
|
}
|
||||||
if m.Option("relay") != "" {
|
if m.Option("relay") != "" {
|
||||||
// 自动认证
|
// 远程登录
|
||||||
m.Cmd("relay", m.Option("relay"), arg[0])
|
m.Cmd("relay", m.Option("relay"), arg[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +124,50 @@ var Index = &ice.Context{Name: "tmux", Help: "工作台",
|
|||||||
m.Cmdy(prefix, "send-keys", "-t", arg[0], v, "Enter")
|
m.Cmdy(prefix, "send-keys", "-t", arg[0], v, "Enter")
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"load": {Name: "load", Help: "序列化", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"make": {Name: "make name cmd...", Help: "个性化", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
prefix := kit.Simple(m.Confv("prefix", "meta.cmd"))
|
||||||
|
session := m.Conf(ice.CLI_RUNTIME, "node.name")
|
||||||
|
if arg[1] == "session" {
|
||||||
|
session, arg[2], arg = arg[2], arg[0], arg[2:]
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Warn(m.Cmd(prefix, "has-session", "-t", session).Append("code") != "0", "session miss") {
|
||||||
|
// 会话不存在
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Cmdx("session", session, "has", arg[0]) != "" {
|
||||||
|
// 窗口已存在
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
switch arg[1] {
|
||||||
|
case "init":
|
||||||
|
m.Cmdx(prefix, "rename-window", "-t", session, arg[0])
|
||||||
|
arg[1], arg = arg[0], arg[1:]
|
||||||
|
case "link":
|
||||||
|
m.Cmdx(prefix, "link-window", "-dt", session, "-s", arg[2])
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
m.Cmd(prefix, "new-window", "-dt", session, "-n", arg[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
if arg[1] == "init" {
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range arg[1:] {
|
||||||
|
switch ls := kit.Split(v); ls[1] {
|
||||||
|
case "v":
|
||||||
|
m.Cmd(prefix, "split-window", "-h", "-dt", session+":"+arg[0]+"."+ls[0], ls[2:])
|
||||||
|
case "u", "split-window":
|
||||||
|
m.Cmd(prefix, "split-window", "-dt", session+":"+arg[0]+"."+ls[0], ls[2:])
|
||||||
|
case "k":
|
||||||
|
m.Cmd(prefix, "send-key", "-t", session+":"+arg[0]+"."+ls[0], ls[2:])
|
||||||
|
default:
|
||||||
|
m.Cmd(prefix, ls[1], "-t", session+":"+arg[0]+"."+ls[0], ls[2:])
|
||||||
|
}
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"text": {Name: "text name 保存:button text:textarea", Help: "文本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"text": {Name: "text name 保存:button text:textarea", Help: "文本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
@ -223,6 +271,15 @@ var Index = &ice.Context{Name: "tmux", Help: "工作台",
|
|||||||
m.Cmdy("windows", target)
|
m.Cmdy("windows", target)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
switch arg[1] {
|
||||||
|
case "has":
|
||||||
|
m.Cmd("windows", target).Table(func(index int, value map[string]string, head []string) {
|
||||||
|
if value["window"] == arg[2] {
|
||||||
|
m.Echo("true")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if target = arg[0] + ":" + arg[1]; m.Cmd(prefix, "rename-window", "-t", target, arg[1]).Append("code") != "0" {
|
if target = arg[0] + ":" + arg[1]; m.Cmd(prefix, "rename-window", "-t", target, arg[1]).Append("code") != "0" {
|
||||||
// 创建窗口
|
// 创建窗口
|
||||||
|
@ -5,20 +5,5 @@ refer "官网" `
|
|||||||
下载 https://www.vim.org/download.php
|
下载 https://www.vim.org/download.php
|
||||||
源码 ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
|
源码 ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
|
||||||
`
|
`
|
||||||
chapter "安装"
|
|
||||||
spark "下载" `
|
|
||||||
wget ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
|
|
||||||
tar xvf vim-8.1.tar.bz2
|
|
||||||
cd vim81
|
|
||||||
`
|
|
||||||
|
|
||||||
spark "安装" `
|
spark terminal
|
||||||
yum install gcc
|
|
||||||
yum install python-devel
|
|
||||||
`
|
|
||||||
|
|
||||||
spark "编译" `
|
|
||||||
./configure --prefix=/home/shaoying/usr/vim --enable-multibyte=yes --enable-cscope=yes --enable-luainterp=yes --enable-pythoninterp=yes
|
|
||||||
make -j4
|
|
||||||
make install
|
|
||||||
`
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user