1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
shaoying 2019-09-16 08:39:40 +08:00
parent 1c43fdaab4
commit c370d7b4aa
7 changed files with 79 additions and 3 deletions

View File

@ -4,5 +4,5 @@ var version = struct {
host string
self int
}{
"2019-09-12 22:20:19", "centos", 532,
"2019-09-14 18:51:31", "com.mac", 494,
}

View File

@ -3,6 +3,7 @@ package ssh
import (
"bufio"
"contexts/ctx"
"encoding/json"
"fmt"
"os/exec"
"sort"
@ -530,9 +531,22 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
case "update":
index := kit.Int(arg[2]) - 1
for i := 3; i < len(arg) - 1; i += 2 {
for i := 3; i < len(arg)-1; i += 2 {
m.Confv("flow", []string{m.Option("river"), "data", arg[1], "list", kit.Format(index), arg[i]}, arg[i+1])
}
case "import":
m.Cmd("nfs.import", arg[2:]).Table(func(maps map[string]string, lists []string, line int) {
data := map[string]interface{}{}
extra := map[string]interface{}{}
for k, v := range maps {
data[k] = v
}
json.Unmarshal(([]byte)(maps["extra"]), &data)
data["extra"] = extra
m.Confv("flow", []string{m.Option("river"), "data", arg[1], "list", "-2"}, map[string]interface{}{})
})
}
return
}},
@ -686,7 +700,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
if rest := kit.Select("", names, 1); names[0] != "" {
// 数字签名
if !m.Options("remote_code") && arg[0] != "_check" {
for _, k := range []string{"river"}{
for _, k := range []string{"river"} {
m.Option(k, m.Option(k))
}

View File

@ -0,0 +1,2 @@
fieldset.item.demo div.output {
}

36
src/plugin/love/index.go Normal file
View File

@ -0,0 +1,36 @@
package main
import (
"contexts/cli"
"contexts/ctx"
"toolkit"
"fmt"
"os"
)
var Index = &ctx.Context{Name: "test", Help: "测试工具",
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:]))
}

4
src/plugin/love/index.js Normal file
View File

@ -0,0 +1,4 @@
{init: function(run, field, option, output) {
kit.Log("hello world")
return {}
}}

20
src/plugin/love/index.shy Normal file
View File

@ -0,0 +1,20 @@
fun meet "第一眼" public \
text "love" name table imports plugin_table \
text "" name when \
text "" name where \
button "操作"
if $2 == ""
copy ssh.data show _
return
end
if $3 == ""
return "meet miss"
end
copy ssh.data insert _ when _ where __
end
kit imports "导入" "" "" private "ssh.data" "import" \
text "love" name table \
text "" name file \
button "导入"

View File