forked from x/ContextOS
add dream
This commit is contained in:
parent
c7d04c114e
commit
b29b30a896
@ -102,7 +102,7 @@ ShyLogout() {
|
|||||||
echo ${ctx_goodbye} && [ "$ctx_sid" != "" ] && Shy logout
|
echo ${ctx_goodbye} && [ "$ctx_sid" != "" ] && Shy logout
|
||||||
}
|
}
|
||||||
ShyLogin() {
|
ShyLogin() {
|
||||||
HOST=`hostname` ctx_sid=`ShyPost cmd login pid "$$" pane "${TMUX_PANE}" hostname "${HOST}" username "${USER}"`
|
HOST=`hostname` ctx_sid=`ShyPost cmd login share "${ctx_share}" pid "$$" pane "${TMUX_PANE}" hostname "${HOST}" username "${USER}"`
|
||||||
echo "sid: ${ctx_sid:0:6}"
|
echo "sid: ${ctx_sid:0:6}"
|
||||||
}
|
}
|
||||||
ShyFavor() {
|
ShyFavor() {
|
||||||
|
@ -21,8 +21,7 @@ fun! ShyLogout()
|
|||||||
endfun
|
endfun
|
||||||
fun! ShyLogin()
|
fun! ShyLogin()
|
||||||
if g:ctx_sid == ""
|
if g:ctx_sid == ""
|
||||||
let g:ctx_sid = ShyPost({"cmd": "login", "pid": getpid(), "pane": $TMUX_PANE, "hostname": hostname(), "username": $USER})
|
let g:ctx_sid = ShyPost({"cmd": "login", "share": $ctx_share, "pid": getpid(), "pane": $TMUX_PANE, "hostname": hostname(), "username": $USER})
|
||||||
"hello
|
|
||||||
endif
|
endif
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
|
@ -90,5 +90,5 @@ bind -t vi-edit C-f cursor-right
|
|||||||
bind -t vi-edit C-j enter
|
bind -t vi-edit C-j enter
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
bind C-r send-keys "export ctx_dev=$ctx_self\ncurl -s \$ctx_dev/publish/auto.sh >auto.sh\nsource auto.sh\n"
|
bind C-r send-keys "export ctx_dev=$ctx_self ctx_share=$ctx_share\ncurl -s \$ctx_dev/publish/auto.sh >auto.sh\nsource auto.sh\n"
|
||||||
source-file ~/.tmux_local
|
source-file ~/.tmux_local
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
~code
|
~code
|
||||||
config save var/tmp/vim/vim.json vim
|
config save var/tmp/vim/vim.json vim
|
||||||
config save var/tmp/zsh.json zsh
|
config save var/tmp/zsh.json zsh
|
||||||
config save var/tmp/code.json login
|
config save var/tmp/code.json dream login
|
||||||
|
|
||||||
# 系统配置
|
# 系统配置
|
||||||
~ssh
|
~ssh
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
# 应用配置
|
# 应用配置
|
||||||
~code
|
~code
|
||||||
config load tmp/code.json login
|
config load tmp/code.json dream login
|
||||||
config load tmp/zsh.json zsh
|
config load tmp/zsh.json zsh
|
||||||
config load tmp/vim/vim.json vim
|
config load tmp/vim/vim.json vim
|
||||||
~wiki
|
~wiki
|
||||||
|
@ -118,19 +118,21 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
"least": 3,
|
"least": 3,
|
||||||
}},
|
}},
|
||||||
"dream": {Name: "dream", Help: "使命必达", Value: map[string]interface{}{
|
"dream": {Name: "dream", Help: "使命必达", Value: map[string]interface{}{
|
||||||
"hello": map[string]interface{}{
|
"topic": map[string]interface{}{
|
||||||
"ship": []interface{}{"tip", "miss.md", "task", "feed"},
|
"hello": map[string]interface{}{
|
||||||
"git": []interface{}{"clone https://github.com/shylinux/context"},
|
"ship": []interface{}{"tip", "miss.md", "task", "feed"},
|
||||||
"tmux": []interface{}{
|
"git": []interface{}{"clone https://github.com/shylinux/context"},
|
||||||
"split-window -t $dream:1.1",
|
"tmux": []interface{}{
|
||||||
"new-window -t $dream:2",
|
"split-window -t $dream:1.1",
|
||||||
"split-window -t $dream:2.1",
|
"new-window -t $dream:2",
|
||||||
"new-window -t $dream:3",
|
"split-window -t $dream:2.1",
|
||||||
"split-window -t $dream:3.1",
|
"new-window -t $dream:3",
|
||||||
|
"split-window -t $dream:3.1",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"share": map[string]interface{}{},
|
||||||
}},
|
}},
|
||||||
"share": {Name: "share", Help: "共享链接", Value: map[string]interface{}{}},
|
|
||||||
},
|
},
|
||||||
Commands: map[string]*ctx.Command{
|
Commands: map[string]*ctx.Command{
|
||||||
"dream": {Name: "dream", Help: "使命必达", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) {
|
"dream": {Name: "dream", Help: "使命必达", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) {
|
||||||
@ -145,15 +147,16 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
// 下载代码
|
// 下载代码
|
||||||
home := path.Join(m.Conf("missyou", "path"), arg[1], m.Conf("missyou", "local"))
|
home := path.Join(m.Conf("missyou", "path"), arg[1], m.Conf("missyou", "local"))
|
||||||
git := kit.Trans(m.Confv("prefix", "git"), "cmd_dir", home)
|
git := kit.Trans(m.Confv("prefix", "git"), "cmd_dir", home)
|
||||||
m.Confm("dream", []string{m.Option("topic"), "git"}, func(index int, value string) {
|
m.Confm("dream", []string{"topic", m.Option("topic"), "git"}, func(index int, value string) {
|
||||||
value = strings.Replace(value, "$dream", arg[1], -1)
|
value = strings.Replace(value, "$dream", arg[1], -1)
|
||||||
m.Cmdx(git, strings.Split(value, " "))
|
m.Cmdx(git, strings.Split(value, " "))
|
||||||
})
|
})
|
||||||
|
|
||||||
// 创建终端
|
// 创建终端
|
||||||
m.Cmds(tmux, "new-session", "-ds", arg[1], "cmd_dir", home,
|
m.Cmds(tmux, "set-environment", "-g", "ctx_share", m.Cmdx("dream", "share"))
|
||||||
"cmd_env", "TMUX", "", "cmd_env", "ctx_share", m.Cmdx("dream", "share"))
|
m.Cmds(tmux, "new-session", "-ds", arg[1], "cmd_dir", home, "cmd_env", "TMUX", "")
|
||||||
m.Confm("dream", []string{m.Option("topic"), "tmux"}, func(index int, value string) {
|
m.Cmds(tmux, "set-environment", "-t", arg[1], "ctx_share", m.Cmdx("dream", "share"))
|
||||||
|
m.Confm("dream", []string{"topic", m.Option("topic"), "tmux"}, func(index int, value string) {
|
||||||
value = strings.Replace(value, "$dream", arg[1], -1)
|
value = strings.Replace(value, "$dream", arg[1], -1)
|
||||||
m.Cmdx(tmux, strings.Split(value, " "), "cmd_dir", home)
|
m.Cmdx(tmux, strings.Split(value, " "), "cmd_dir", home)
|
||||||
})
|
})
|
||||||
@ -162,16 +165,16 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
fallthrough
|
fallthrough
|
||||||
case "share":
|
case "share":
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
m.Confm("dream", []string{kit.Select("hello", m.Option("topic")), "ship"}, func(index int, value string) {
|
m.Confm("dream", []string{"topic", kit.Select("hello", m.Option("topic")), "ship"}, func(index int, value string) {
|
||||||
arg = append(arg, value)
|
arg = append(arg, value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
h := kit.Hashs("uniq")[:6]
|
h := kit.Hashs("uniq")[:6]
|
||||||
if m.Confs("share", []string{"hash", h}) {
|
if m.Confs("dream", []string{"share", "hash", h}) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
m.Conf("share", []string{"hash", h}, map[string]interface{}{
|
m.Conf("dream", []string{"share", "hash", h}, map[string]interface{}{
|
||||||
"river": m.Option("river"),
|
"river": m.Option("river"),
|
||||||
"dream": m.Option("dream"),
|
"dream": m.Option("dream"),
|
||||||
"favor": kit.Select("tip", arg, 1),
|
"favor": kit.Select("tip", arg, 1),
|
||||||
@ -185,12 +188,12 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "bind":
|
case "bind":
|
||||||
m.Confm("share", []string{"hash", arg[1]}, func(value map[string]interface{}) {
|
m.Confm("dream", []string{"share", "hash", arg[1]}, func(value map[string]interface{}) {
|
||||||
m.Conf("login", []string{"hash", m.Option("sid"), "ship"}, value)
|
m.Conf("login", []string{"hash", m.Option("sid"), "ship"}, value)
|
||||||
})
|
})
|
||||||
|
|
||||||
case "list":
|
case "list":
|
||||||
m.Confm("share", "hash", func(key string, value map[string]interface{}) {
|
m.Confm("dream", "share.hash", func(key string, value map[string]interface{}) {
|
||||||
m.Push("key", key)
|
m.Push("key", key)
|
||||||
m.Push("river", value["river"])
|
m.Push("river", value["river"])
|
||||||
m.Push("dream", value["dream"])
|
m.Push("dream", value["dream"])
|
||||||
@ -222,6 +225,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
"time": m.Time(),
|
"time": m.Time(),
|
||||||
"type": kit.Select("vim", arg, 1),
|
"type": kit.Select("vim", arg, 1),
|
||||||
"status": "login",
|
"status": "login",
|
||||||
|
"ship": m.Confv("dream", []string{"share", "hash", m.Option("share")}),
|
||||||
"pwd": m.Option("pwd"),
|
"pwd": m.Option("pwd"),
|
||||||
"pid": m.Option("pid"),
|
"pid": m.Option("pid"),
|
||||||
"pane": m.Option("pane"),
|
"pane": m.Option("pane"),
|
||||||
@ -232,8 +236,8 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
|
|
||||||
case "list":
|
case "list":
|
||||||
// 清理终端
|
// 清理终端
|
||||||
if len(arg) > 2 && arg[2] == "prune" {
|
if len(arg) > 3 && arg[3] == "prune" {
|
||||||
m.Cmd(".prune", m.Conf("login", []string{"hash", arg[1], "type"}), arg[1])
|
m.Cmd(".prune", m.Conf("login", []string{"hash", arg[2], "type"}), arg[2])
|
||||||
arg = arg[:1]
|
arg = arg[:1]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,14 +341,10 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
|
|
||||||
case "list":
|
case "list":
|
||||||
if len(arg) > 2 && arg[2] == "modify" {
|
if len(arg) > 2 && arg[2] == "modify" {
|
||||||
m.Cmdy("ssh._route", m.Option("dream"), "ssh.data", "update", m.Option("favor"), arg[1], arg[3], arg[4])
|
m.Cmdy("ssh.data", "update", m.Option("favor"), arg[1], arg[3], arg[4])
|
||||||
arg = []string{"list", m.Option("dream"), m.Option("favor")}
|
arg = []string{"list", m.Option("favor"), arg[1]}
|
||||||
}
|
}
|
||||||
if len(arg) > 1 {
|
m.Cmdy("ssh.data", "show", arg[1:])
|
||||||
m.Cmdy("ssh._route", arg[1], "ssh.data", "show", arg[2:])
|
|
||||||
break
|
|
||||||
}
|
|
||||||
m.Cmdy("ssh.data", "show")
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
3
src/plugin/dream/index.css
Normal file
3
src/plugin/dream/index.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fieldset.item.dream div.output {
|
||||||
|
}
|
||||||
|
|
36
src/plugin/dream/index.go
Normal file
36
src/plugin/dream/index.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"contexts/cli"
|
||||||
|
"contexts/ctx"
|
||||||
|
"toolkit"
|
||||||
|
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Index = &ctx.Context{Name: `dream`, Help: `plugin`,
|
||||||
|
Caches: map[string]*ctx.Cache{},
|
||||||
|
Configs: map[string]*ctx.Config{
|
||||||
|
"_index": &ctx.Config{Name: "index", Value: []interface{}{
|
||||||
|
map[string]interface{}{"name": "demo", "help": "demo",
|
||||||
|
"tmpl": "componet", "view": "", "init": "",
|
||||||
|
"type": "public", "ctx": "demo", "cmd": "demo",
|
||||||
|
"args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "value": "hello world"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
Commands: map[string]*ctx.Command{
|
||||||
|
"demo": {Name: "demo", Help: "demo", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
m.Echo(kit.Select("hello world", arg, 0))
|
||||||
|
return
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Print(cli.Index.Plugin(Index, os.Args[1:]))
|
||||||
|
}
|
3
src/plugin/dream/index.js
Normal file
3
src/plugin/dream/index.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Script["dream/index.js"] = function(field, option, output) {return {
|
||||||
|
}}
|
||||||
|
|
3
src/plugin/dream/index.shy
Normal file
3
src/plugin/dream/index.shy
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
kit share "梦想主题" private "web.code.dream" list \
|
||||||
|
button "查看"
|
||||||
|
|
@ -10,10 +10,7 @@ kit tips "便签" private "_:web.code.favor" list \
|
|||||||
kit editor "编辑器" private "web.code.login" list \
|
kit editor "编辑器" private "web.code.login" list \
|
||||||
text "" name sid imports plugin_vim_sid action auto \
|
text "" name sid imports plugin_vim_sid action auto \
|
||||||
text "" name dream imports plugin_you \
|
text "" name dream imports plugin_you \
|
||||||
text "tip" name favor imports plugin_vim_favor \
|
text "" name topic imports plugin_see \
|
||||||
text "miss.md" name story imports plugin_story \
|
|
||||||
text "task" name stage imports plugin_stage \
|
|
||||||
text "feed" name order imports plugin_order \
|
|
||||||
feature detail "prune" "复制" "下载" \
|
feature detail "prune" "复制" "下载" \
|
||||||
exports vim_sid sid \
|
exports vim_sid sid \
|
||||||
button "查看" action auto
|
button "查看" action auto
|
||||||
|
@ -16,10 +16,7 @@ kit taps "便签" private "_:web.code.favor" list \
|
|||||||
kit terminal "终端" private "web.code.login" list \
|
kit terminal "终端" private "web.code.login" list \
|
||||||
text "" name sid imports plugin_zsh_sid action auto \
|
text "" name sid imports plugin_zsh_sid action auto \
|
||||||
text "" name dream imports plugin_you \
|
text "" name dream imports plugin_you \
|
||||||
text "tap" name favor imports plugin_zsh_favor \
|
text "" name topic imports plugin_see \
|
||||||
text "miss.md" name story imports plugin_story \
|
|
||||||
text "task" name stage imports plugin_stage \
|
|
||||||
text "feed" name order imports plugin_order \
|
|
||||||
feature detail "prune" "复制" "下载" \
|
feature detail "prune" "复制" "下载" \
|
||||||
exports zsh_sid sid \
|
exports zsh_sid sid \
|
||||||
button "查看" action auto
|
button "查看" action auto
|
||||||
|
@ -17,6 +17,31 @@ code wiki chat team mall
|
|||||||
规律 平台 特征 智能
|
规律 平台 特征 智能
|
||||||
`}}
|
`}}
|
||||||
|
|
||||||
|
{{order "启动流程" `
|
||||||
|
zone.sh
|
||||||
|
user.sh
|
||||||
|
node.sh
|
||||||
|
`}}
|
||||||
|
|
||||||
|
{{order "会话流程" `
|
||||||
|
ocean
|
||||||
|
river
|
||||||
|
action
|
||||||
|
source
|
||||||
|
target
|
||||||
|
storm
|
||||||
|
steam
|
||||||
|
`}}
|
||||||
|
|
||||||
|
{{order "工作流程" `
|
||||||
|
dream
|
||||||
|
favor
|
||||||
|
story
|
||||||
|
share
|
||||||
|
stage
|
||||||
|
order
|
||||||
|
`}}
|
||||||
|
|
||||||
## 系统设计
|
## 系统设计
|
||||||
|
|
||||||
{{table "context" `
|
{{table "context" `
|
||||||
|
Loading…
x
Reference in New Issue
Block a user