mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt ssh
This commit is contained in:
parent
dd595a3a89
commit
e377cc4521
@ -66,7 +66,6 @@ func Render(msg *ice.Message, cmd string, args ...interface{}) {
|
||||
}
|
||||
msg.Append(ice.MSG_OUTPUT, ice.RENDER_OUTPUT)
|
||||
}
|
||||
|
||||
func _ssh_script(m *ice.Message, name string) io.Reader {
|
||||
if strings.Contains(m.Option("_script"), "/") {
|
||||
name = path.Join(path.Dir(m.Option("_script")), name)
|
||||
@ -383,8 +382,6 @@ var Index = &ice.Context{Name: "ssh", Help: "终端模块",
|
||||
"PS2", []interface{}{"count", " ", "target", "> "},
|
||||
)},
|
||||
REMOTE: {Name: "remote", Help: "远程连接", Value: kit.Data()},
|
||||
|
||||
"dial": {Name: "dial", Help: "远程连接", Value: kit.Data()},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
|
@ -422,19 +422,33 @@ func init() {
|
||||
m.Cmdy(mdb.SELECT, m.Prefix(COMMAND), "", mdb.LIST, kit.MDB_ID, arg)
|
||||
}},
|
||||
|
||||
DIAL: {Name: "dial hash=auto auto 登录 cmd:textarea=pwd", Help: "连接", Action: map[string]*ice.Action{
|
||||
mdb.CREATE: {Name: "create username=shy hostname=shylinux.com port=22", Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
||||
if connect, e := _ssh_dial(m, m.Option(aaa.USERNAME),
|
||||
m.Option(aaa.HOSTPORT, m.Option("hostname")+":"+m.Option("port"))); m.Assert(e) {
|
||||
h := m.Rich(DIAL, "", kit.Dict(
|
||||
aaa.USERNAME, m.Option(aaa.USERNAME), aaa.HOSTPORT, m.Option(aaa.HOSTPORT), CONNECT, connect,
|
||||
))
|
||||
DIAL: {Name: "dial hash=auto auto 添加 导出 导入 cmd:textarea=pwd", Help: "连接", Action: map[string]*ice.Action{
|
||||
mdb.CREATE: {Name: "create username=shy hostname=shylinux.com port=22", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||
if connect, e := _ssh_dial(m, m.Option(aaa.USERNAME), m.Option(aaa.HOSTPORT, m.Option("hostname")+":"+m.Option("port"))); m.Assert(e) {
|
||||
h := m.Rich(DIAL, "", kit.Dict(aaa.USERNAME, m.Option(aaa.USERNAME), aaa.HOSTPORT, m.Option(aaa.HOSTPORT), CONNECT, connect))
|
||||
m.Echo(h)
|
||||
}
|
||||
}},
|
||||
mdb.DELETE: {Name: "delete", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(mdb.DELETE, m.Prefix(DIAL), "", mdb.HASH, kit.MDB_HASH, m.Option(kit.MDB_HASH))
|
||||
}},
|
||||
mdb.EXPORT: {Name: "export file=.ssh/known_hosts", Help: "导出", Hand: func(m *ice.Message, arg ...string) {
|
||||
list := []string{}
|
||||
if m.Cmd(mdb.SELECT, m.Prefix(PUBLIC), "", mdb.HASH).Table(func(index int, value map[string]string, head []string) {
|
||||
list = append(list, fmt.Sprintf("%s %s %s", value[kit.MDB_TYPE], value[kit.MDB_TEXT], value[kit.MDB_NAME]))
|
||||
}); len(list) > 0 {
|
||||
m.Cmdy(nfs.SAVE, path.Join(os.Getenv("HOME"), m.Option(kit.MDB_FILE)), strings.Join(list, "\n")+"\n")
|
||||
}
|
||||
}},
|
||||
mdb.IMPORT: {Name: "import file=.ssh/known_hosts", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
|
||||
p := path.Join(os.Getenv("HOME"), m.Option(kit.MDB_FILE))
|
||||
for _, pub := range strings.Split(m.Cmdx(nfs.CAT, p), "\n") {
|
||||
if len(pub) > 10 {
|
||||
m.Cmd(PUBLIC, mdb.CREATE, "publickey", pub)
|
||||
}
|
||||
}
|
||||
m.Echo(p)
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if len(arg) == 0 || arg[0] == "" {
|
||||
m.Option(mdb.FIELDS, m.Conf(DIAL, kit.META_FIELD))
|
||||
|
@ -114,18 +114,15 @@ func init() {
|
||||
case func(string):
|
||||
cb(p)
|
||||
default:
|
||||
m.Cmdy(cli.SYSTEM, "./configure", "--prefix="+kit.Path(path.Join(p, INSTALL)), arg[1:])
|
||||
if m.Append(cli.CMD_CODE) != "0" {
|
||||
if m.Cmdy(cli.SYSTEM, "./configure", "--prefix="+kit.Path(path.Join(p, INSTALL)), arg[1:]); m.Append(cli.CMD_CODE) != "0" {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
m.Cmdy(cli.SYSTEM, "make", "-j8")
|
||||
if m.Append(cli.CMD_CODE) != "0" {
|
||||
if m.Cmdy(cli.SYSTEM, "make", "-j8"); m.Append(cli.CMD_CODE) != "0" {
|
||||
return
|
||||
}
|
||||
m.Cmdy(cli.SYSTEM, "make", "PREFIX="+kit.Path(path.Join(p, INSTALL)), "install")
|
||||
if m.Append(cli.CMD_CODE) != "0" {
|
||||
if m.Cmdy(cli.SYSTEM, "make", "PREFIX="+kit.Path(path.Join(p, INSTALL)), "install"); m.Append(cli.CMD_CODE) != "0" {
|
||||
return
|
||||
}
|
||||
}},
|
||||
|
@ -70,21 +70,28 @@ var Index = &ice.Context{Name: GIT, Help: "代码库",
|
||||
})
|
||||
}},
|
||||
|
||||
GIT: {Name: "git port=auto path=auto auto 构建 下载", Help: "代码库", Action: map[string]*ice.Action{
|
||||
GIT: {Name: "git port=auto path=auto auto 启动 构建 下载", Help: "代码库", Action: map[string]*ice.Action{
|
||||
"download": {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, "download", m.Conf(GIT, kit.META_SOURCE))
|
||||
}},
|
||||
"build": {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Optionv("prepare", func(p string) {
|
||||
m.Option(cli.CMD_DIR, p)
|
||||
m.Cmd(cli.SYSTEM, "mv", "INSTALL", "INSTALLS")
|
||||
if m.Cmdy(cli.SYSTEM, "./configure", "--prefix="+kit.Path(path.Join(p, code.INSTALL))); m.Append(cli.CMD_CODE) != "0" {
|
||||
return
|
||||
}
|
||||
})
|
||||
m.Cmdy(code.INSTALL, "build", m.Conf(GIT, kit.META_SOURCE))
|
||||
}},
|
||||
"start": {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Optionv("prepare", func(p string) []string {
|
||||
m.Option(cli.CMD_DIR, p)
|
||||
kit.Fetch(m.Confv(GIT, "meta.config"), func(conf string, value interface{}) {
|
||||
kit.Fetch(value, func(key string, value string) {
|
||||
m.Cmd(cli.SYSTEM, "bin/git", "config", "--global", conf+"."+key, value)
|
||||
})
|
||||
})
|
||||
// kit.Fetch(m.Confv(GIT, "meta.config"), func(conf string, value interface{}) {
|
||||
// kit.Fetch(value, func(key string, value string) {
|
||||
// m.Cmd(cli.SYSTEM, "bin/git", "config", "--global", conf+"."+key, value)
|
||||
// })
|
||||
// })
|
||||
return []string{}
|
||||
})
|
||||
m.Cmdy(code.INSTALL, "start", m.Conf(GIT, kit.META_SOURCE), "bin/git")
|
||||
|
@ -5,28 +5,27 @@ refer "官网" `
|
||||
文档 https://git-scm.com/docs
|
||||
`
|
||||
premenu
|
||||
field "安装" web.code.git.git
|
||||
field "源码" web.code.inner args `[ usr/install/git-1.8.3.1/ shell.c 145 ]`
|
||||
|
||||
chapter "安装"
|
||||
section "编译安装"
|
||||
chapter "源码"
|
||||
field git web.code.git.git
|
||||
field git web.code.inner args `[ usr/install/git-1.8.3.1/ shell.c 145 ]`
|
||||
|
||||
section "构建"
|
||||
spark shell `
|
||||
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
|
||||
|
||||
./configure --prefix=$PWD/install
|
||||
make -j4 && make install
|
||||
`
|
||||
|
||||
section "使用体验"
|
||||
section "启动"
|
||||
spark shell `
|
||||
cd ./install
|
||||
./bin/git
|
||||
`
|
||||
|
||||
chapter "应用"
|
||||
refer `
|
||||
go https://github.com/google/gitprotocolio
|
||||
`
|
||||
field "代码库" web.code.git.repos
|
||||
field "统计量" web.code.git.total
|
||||
field "代码管理" web.code.git.status
|
||||
@ -34,4 +33,7 @@ field "提交趋势" web.code.git.trend args icebergs
|
||||
field "代码结构" web.code.git.spide args icebergs
|
||||
|
||||
chapter "项目"
|
||||
refer `
|
||||
go https://github.com/google/gitprotocolio
|
||||
`
|
||||
field icebergs web.code.inner args `[ usr/icebergs misc/git/git.go ]`
|
||||
|
@ -58,7 +58,7 @@ var Index = &ice.Context{Name: TMUX, Help: "工作台",
|
||||
"start": {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Optionv("prepare", func(p string) []string {
|
||||
m.Option(cli.CMD_DIR, p)
|
||||
return []string{}
|
||||
return []string{"-S", kit.Path(p, "tmux.socket"), "new-session", "-dn", "miss"}
|
||||
})
|
||||
m.Cmdy(code.INSTALL, "start", m.Conf(TMUX, kit.META_SOURCE), "bin/tmux")
|
||||
}},
|
||||
|
@ -6,11 +6,11 @@ refer "官网" `
|
||||
`
|
||||
premenu
|
||||
|
||||
chapter "源码"
|
||||
field tmux web.code.tmux.tmux
|
||||
field tmux web.code.inner args `[ usr/install/tmux-3.1b cmd-bind-key.c ]`
|
||||
|
||||
chapter "安装"
|
||||
section "编译安装"
|
||||
section "构建"
|
||||
spark shell `
|
||||
yum install -y gcc make libevent-devel.x86_64 ncurses-devel.x86_64
|
||||
|
||||
@ -19,13 +19,12 @@ tar xvf tmux-3.1b.tar.gz && cd tmux-3.1b
|
||||
|
||||
./configure --prefix=$PWD/install
|
||||
make -j8 && make install
|
||||
|
||||
`
|
||||
|
||||
section "使用体验"
|
||||
section "启动"
|
||||
spark shell `
|
||||
cd ./install
|
||||
./bin/tmux
|
||||
./bin/tmux -S $PWD/tmux.socket
|
||||
`
|
||||
|
||||
chapter "应用"
|
||||
|
@ -21,6 +21,45 @@ const VIMRC = "vimrc"
|
||||
|
||||
var Index = &ice.Context{Name: VIM, Help: "编辑器",
|
||||
Commands: map[string]*ice.Command{
|
||||
VIM: {Name: "vim port=auto path=auto auto 启动 构建 下载", Help: "编辑器", Action: map[string]*ice.Action{
|
||||
"download": {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, "download", m.Conf(VIM, kit.META_SOURCE))
|
||||
}},
|
||||
"build": {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, "build", strings.Replace(strings.Replace(kit.TrimExt(m.Conf(VIM, kit.META_SOURCE)), ".", "", -1), "-", "", -1))
|
||||
}},
|
||||
"start": {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Optionv("prepare", func(p string) []string {
|
||||
return []string{}
|
||||
list := kit.Simple(m.Confv(VIM, "meta.start"))
|
||||
for i := 0; i < len(list); i += 2 {
|
||||
m.Cmd(web.SPIDE, "dev", web.SPIDE_SAVE, path.Join(os.Getenv("HOME"), list[i]),
|
||||
web.SPIDE_GET, m.Conf(VIM, "meta.remote")+list[i+1])
|
||||
}
|
||||
return []string{"-T", "screen", "-c", "PlugInstall", "-c", "exit", "-c", "exit"}
|
||||
})
|
||||
m.Cmdy(code.INSTALL, "start", strings.Replace(strings.Replace(kit.TrimExt(m.Conf(VIM, kit.META_SOURCE)), ".", "", -1), "-", "", -1), "bin/vim")
|
||||
|
||||
// 安装插件
|
||||
m.Echo("\n")
|
||||
m.Echo("vim -c PlugInstall\n")
|
||||
m.Echo("vim -c GoInstallBinaries\n")
|
||||
}},
|
||||
|
||||
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(m.Conf(VIM, "meta.plug"))
|
||||
}},
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if strings.HasPrefix(arg[2], "http") {
|
||||
m.Cmdy(web.SPIDE, "dev", "raw", "GET", arg[2]+arg[1])
|
||||
return
|
||||
}
|
||||
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.META_SOURCE)), arg)
|
||||
}},
|
||||
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Conf(web.FAVOR, "meta.render.vimrc", m.AddCmd(&ice.Command{Name: "render favor id", Help: "渲染引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
value := m.Optionv("value").(map[string]interface{})
|
||||
@ -52,46 +91,6 @@ var Index = &ice.Context{Name: VIM, Help: "编辑器",
|
||||
m.Cmd("web.spide_rewrite", "create", "from", "https://raw.githubusercontent.com/shylinux/contexts/master/etc/conf/plug.vim", "to", "http://localhost:9020/publish/plug.vim")
|
||||
m.Cmd("nfs.file_rewrite", "create", "from", "etc/conf/plug.vim", "to", "https://raw.githubusercontent.com/shylinux/contexts/master/etc/conf/plug.vim")
|
||||
}},
|
||||
VIM: {Name: "vim port=auto path=auto auto 构建 下载", Help: "编辑器", Action: map[string]*ice.Action{
|
||||
"download": {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, "download", m.Conf(VIM, kit.META_SOURCE))
|
||||
}},
|
||||
"build": {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, "build",
|
||||
strings.Replace(strings.Replace(kit.TrimExt(m.Conf(VIM, kit.META_SOURCE)), ".", "", -1), "-", "", -1))
|
||||
}},
|
||||
"start": {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Optionv("prepare", func(p string) []string {
|
||||
list := kit.Simple(m.Confv(VIM, "meta.start"))
|
||||
for i := 0; i < len(list); i += 2 {
|
||||
m.Cmd(web.SPIDE, "dev", web.SPIDE_SAVE, path.Join(os.Getenv("HOME"), list[i]),
|
||||
web.SPIDE_GET, m.Conf(VIM, "meta.remote")+list[i+1])
|
||||
}
|
||||
return []string{"-T", "screen", "-c", "PlugInstall", "-c", "exit", "-c", "exit"}
|
||||
})
|
||||
m.Cmdy(code.INSTALL, "start",
|
||||
strings.Replace(strings.Replace(kit.TrimExt(m.Conf(VIM, kit.META_SOURCE)), ".", "", -1), "-", "", -1),
|
||||
"bin/vim")
|
||||
|
||||
// 安装插件
|
||||
m.Echo("\n")
|
||||
m.Echo("vim -c PlugInstall\n")
|
||||
m.Echo("vim -c GoInstallBinaries\n")
|
||||
}},
|
||||
|
||||
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(m.Conf(VIM, "meta.plug"))
|
||||
}},
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if strings.HasPrefix(arg[2], "http") {
|
||||
m.Cmdy(web.SPIDE, "dev", "raw", "GET", arg[2]+arg[1])
|
||||
return
|
||||
}
|
||||
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.META_SOURCE)), arg)
|
||||
}},
|
||||
|
||||
"/sync": {Name: "/sync", Help: "同步", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Render(ice.RENDER_RESULT)
|
||||
|
@ -6,8 +6,13 @@ refer "官网" `
|
||||
`
|
||||
premenu
|
||||
|
||||
chapter "安装"
|
||||
section "编译安装"
|
||||
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/vim81/install/share/vim/vim81/ filetype.vim ]`
|
||||
field "文档" web.code.inner args `[ usr/install/vim81/install/share/vim/vim81/doc/ help.txt ]`
|
||||
|
||||
section "构建"
|
||||
spark shell `
|
||||
wget ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
|
||||
tar xvf vim-8.1.tar.bz2 && cd vim81
|
||||
@ -15,17 +20,11 @@ tar xvf vim-8.1.tar.bz2 && cd vim81
|
||||
make -j4 && make install
|
||||
`
|
||||
|
||||
section "使用体验"
|
||||
section "启动"
|
||||
spark shell `
|
||||
cd ./install
|
||||
./bin/vim
|
||||
`
|
||||
section "项目"
|
||||
field "安装" web.code.vim.vim
|
||||
field "源码" web.code.inner args `[ usr/install/vim81/ src/main.c 110 ]`
|
||||
field "脚本" web.code.inner args `[ usr/install/vim81/install/share/vim/vim81/ filetype.vim ]`
|
||||
field "文档" web.code.inner args `[ usr/install/vim81/install/share/vim/vim81/doc/ help.txt ]`
|
||||
|
||||
chapter "使用"
|
||||
|
||||
chapter "配置"
|
||||
|
Loading…
x
Reference in New Issue
Block a user