mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-28 18:02:02 +08:00
add love
This commit is contained in:
parent
1c43fdaab4
commit
c370d7b4aa
@ -4,5 +4,5 @@ var version = struct {
|
|||||||
host string
|
host string
|
||||||
self int
|
self int
|
||||||
}{
|
}{
|
||||||
"2019-09-12 22:20:19", "centos", 532,
|
"2019-09-14 18:51:31", "com.mac", 494,
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package ssh
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"contexts/ctx"
|
"contexts/ctx"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"sort"
|
"sort"
|
||||||
@ -533,6 +534,19 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
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])
|
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
|
return
|
||||||
}},
|
}},
|
||||||
|
2
src/plugin/love/index.css
Normal file
2
src/plugin/love/index.css
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
fieldset.item.demo div.output {
|
||||||
|
}
|
36
src/plugin/love/index.go
Normal file
36
src/plugin/love/index.go
Normal 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
4
src/plugin/love/index.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{init: function(run, field, option, output) {
|
||||||
|
kit.Log("hello world")
|
||||||
|
return {}
|
||||||
|
}}
|
20
src/plugin/love/index.shy
Normal file
20
src/plugin/love/index.shy
Normal 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 "导入"
|
0
src/plugin/love/local.shy
Normal file
0
src/plugin/love/local.shy
Normal file
Loading…
x
Reference in New Issue
Block a user