forked from x/ContextOS
add plugin zsh
This commit is contained in:
parent
ac57e760ec
commit
02bf313a7e
@ -156,6 +156,9 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
"zsh": {Name: "zsh dir grep key [split reg fields] [filter reg fields] [order key method] [group keys method] [sort keys method]",
|
"zsh": {Name: "zsh dir grep key [split reg fields] [filter reg fields] [order key method] [group keys method] [sort keys method]",
|
||||||
Form: map[string]int{"split": 2, "filter": 2, "order": 2, "group": 2, "sort": 2, "limit": 2},
|
Form: map[string]int{"split": 2, "filter": 2, "order": 2, "group": 2, "sort": 2, "limit": 2},
|
||||||
Help: "终端", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) {
|
Help: "终端", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) {
|
||||||
|
if len(arg) == 0 {
|
||||||
|
arg = append(arg, "")
|
||||||
|
}
|
||||||
p, arg := kit.Select(".", arg[0]), arg[1:]
|
p, arg := kit.Select(".", arg[0]), arg[1:]
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "prune":
|
case "prune":
|
||||||
|
3
src/plugin/zsh/index.css
Normal file
3
src/plugin/zsh/index.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fieldset.item.zsh div.output {
|
||||||
|
}
|
||||||
|
|
36
src/plugin/zsh/index.go
Normal file
36
src/plugin/zsh/index.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"contexts/cli"
|
||||||
|
"contexts/ctx"
|
||||||
|
"toolkit"
|
||||||
|
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Index = &ctx.Context{Name: `zsh`, 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/zsh/index.js
Normal file
3
src/plugin/zsh/index.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Script["zsh/index.js"] = function(field, option, output) {return {
|
||||||
|
}}
|
||||||
|
|
11
src/plugin/zsh/index.shy
Normal file
11
src/plugin/zsh/index.shy
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
kit terminal "终端" private "web.code.zsh" "" terminal \
|
||||||
|
text "times sids status pid pane hostname" name fields \
|
||||||
|
feature detail "prune" "复制" "下载" \
|
||||||
|
button "查看" action auto
|
||||||
|
|
||||||
|
kit history "命令" private "web.code.zsh" "" history \
|
||||||
|
text "10" name limit view tiny \
|
||||||
|
text "0" name offset view tiny \
|
||||||
|
text "times sids cmd pwd" name fields \
|
||||||
|
button "查看" action auto
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user