From 13714d65b7079a796c969b5bf36ae484075e50b0 Mon Sep 17 00:00:00 2001 From: shaoying Date: Sun, 30 Aug 2020 12:43:04 +0800 Subject: [PATCH] opt some --- base/ssh/ssh.go | 9 ++++++++- misc/git/git.go | 2 +- misc/vim/vim.go | 2 +- misc/zsh/zsh.go | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/base/ssh/ssh.go b/base/ssh/ssh.go index 20f97b3f..d4fcb0d1 100644 --- a/base/ssh/ssh.go +++ b/base/ssh/ssh.go @@ -294,7 +294,14 @@ func (f *Frame) Start(m *ice.Message, arg ...string) bool { f.target = m.Source() break } - if s, e := os.Open(arg[0]); !m.Warn(e != nil, "%s", e) { + s, e := os.Open(arg[0]) + if os.IsNotExist(e) && strings.HasPrefix(arg[0], "usr") { + ls := strings.Split(arg[0], "/") + m.Cmd("web.code.git.repos", ls[1], "usr/"+ls[1]) + s, e = os.Open(arg[0]) + } + + if !m.Warn(e != nil, "%s", e) { defer s.Close() buf := bytes.NewBuffer(make([]byte, 0, 4096)) diff --git a/misc/git/git.go b/misc/git/git.go index 513a48df..e458cde7 100644 --- a/misc/git/git.go +++ b/misc/git/git.go @@ -74,7 +74,7 @@ var Index = &ice.Context{Name: GIT, Help: "代码库", }) }}, - GIT: {Name: "git port=auto path=auto auto 启动:button 构建:button 下载:button", 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)) }}, diff --git a/misc/vim/vim.go b/misc/vim/vim.go index 7db95075..348bbb84 100644 --- a/misc/vim/vim.go +++ b/misc/vim/vim.go @@ -52,7 +52,7 @@ 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 启动:button 构建:button 下载:button", Help: "编辑器", Action: map[string]*ice.Action{ + 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)) }}, diff --git a/misc/zsh/zsh.go b/misc/zsh/zsh.go index 16682291..f621a4ee 100644 --- a/misc/zsh/zsh.go +++ b/misc/zsh/zsh.go @@ -72,7 +72,7 @@ var Index = &ice.Context{Name: ZSH, Help: "命令行", }}, ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.Cmd("web.spide_rewrite", "create", "from", "https://sourceforge.net/projects/zsh/files/zsh/5.8/zsh-5.8.tar.xz", "to", "http://localhost:9020/publish/zsh-5.8.tar.gz") + // m.Cmd("web.spide_rewrite", "create", "from", "https://sourceforge.net/projects/zsh/files/zsh/5.8/zsh-5.8.tar.xz", "to", "http://localhost:9020/publish/zsh-5.8.tar.gz") m.Conf(web.FAVOR, "meta.render.shell", m.AddCmd(&ice.Command{Name: "render type name text", Help: "渲染引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { value, _ := m.Optionv(kit.MDB_VALUE).(map[string]interface{})