mirror of
https://shylinux.com/x/ContextOS
synced 2025-06-26 18:07:30 +08:00
opt dir
This commit is contained in:
parent
6ee5fd4608
commit
e077dcfca5
@ -7,5 +7,5 @@ var version = struct {
|
|||||||
self int
|
self int
|
||||||
}{
|
}{
|
||||||
[]string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"},
|
[]string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"},
|
||||||
`2019-10-21 14:20:01`, `centos`, 633,
|
`2019-10-23 08:31:12`, `mac`, 647,
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,11 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
|||||||
"dir": &ctx.Command{Name: "dir [path [fields...]]", Help: []string{
|
"dir": &ctx.Command{Name: "dir [path [fields...]]", Help: []string{
|
||||||
"查看目录, path: 路径, fields...: 查询字段, time|type|full|path|name|tree|size|line|hash|hashs",
|
"查看目录, path: 路径, fields...: 查询字段, time|type|full|path|name|tree|size|line|hash|hashs",
|
||||||
"dir_deep: 递归查询", "dir_type both|file|dir|all: 文件类型", "dir_reg reg: 正则表达式", "dir_sort field order: 排序"},
|
"dir_deep: 递归查询", "dir_type both|file|dir|all: 文件类型", "dir_reg reg: 正则表达式", "dir_sort field order: 排序"},
|
||||||
Form: map[string]int{"dir_deep": 0, "dir_type": 1, "dir_reg": 1, "dir_sort": 2, "dir_sed": -1, "dir_select": -1},
|
Form: map[string]int{"dir_deep": 0, "dir_type": 1, "dir_reg": 1, "dir_sort": 2, "dir_sed": -1, "dir_select": -1,
|
||||||
|
"offset": 1, "limit": 1,
|
||||||
|
"match_begin": 1,
|
||||||
|
"match_end": 1,
|
||||||
|
},
|
||||||
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
arg = append(arg, "")
|
arg = append(arg, "")
|
||||||
@ -657,11 +661,34 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.Log("info", "open %v", p0)
|
m.Log("info", "open %v", p0)
|
||||||
|
|
||||||
for bio := bufio.NewScanner(f); bio.Scan(); {
|
|
||||||
m.Echo(bio.Text())
|
|
||||||
}
|
|
||||||
m.Append("file", p)
|
m.Append("file", p)
|
||||||
|
|
||||||
|
if m.Has("match_begin") {
|
||||||
|
m.Option("match_begin")
|
||||||
|
begin, _ := regexp.Compile(m.Option("match_begin"))
|
||||||
|
end, _ := regexp.Compile(m.Option("match_end"))
|
||||||
|
start := false
|
||||||
|
for bio := bufio.NewScanner(f); bio.Scan(); {
|
||||||
|
if start = start || begin.MatchString(bio.Text()); m.Option("match_begin") == "" || start {
|
||||||
|
if m.Echo(bio.Text()); m.Option("match_end") != "" && end.MatchString(bio.Text()) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
offset := m.Optioni("offset")
|
||||||
|
limit := m.Optioni("limit")
|
||||||
|
for bio, i := bufio.NewScanner(f), 0; bio.Scan(); i++ {
|
||||||
|
if i >= offset && (limit == 0 || i < offset+limit) {
|
||||||
|
m.Echo(bio.Text())
|
||||||
|
}
|
||||||
|
m.Append("line", i+1)
|
||||||
|
m.Append("offset", offset)
|
||||||
|
m.Append("limit", limit)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m.Append("size", s.Size())
|
m.Append("size", s.Size())
|
||||||
m.Append("time", s.ModTime().Format(m.Conf("time", "format")))
|
m.Append("time", s.ModTime().Format(m.Conf("time", "format")))
|
||||||
skip = true
|
skip = true
|
||||||
|
@ -676,7 +676,7 @@ var Index = &ctx.Context{Name: "yac", Help: "语法中心",
|
|||||||
if e1 == nil && e2 == nil {
|
if e1 == nil && e2 == nil {
|
||||||
result = fmt.Sprintf("%d", v1-v2)
|
result = fmt.Sprintf("%d", v1-v2)
|
||||||
} else {
|
} else {
|
||||||
result = strings.Replace(arg[0], arg[1], "", -1)
|
result = strings.Replace(arg[0], arg[2], "", -1)
|
||||||
}
|
}
|
||||||
case "*":
|
case "*":
|
||||||
result = arg[0]
|
result = arg[0]
|
||||||
|
@ -53,11 +53,12 @@ kit dir "目录" private "ssh._route" _ "nfs.dir" _ time size line path \
|
|||||||
text "usr/script" name dir imports plugin_dir action auto view long \
|
text "usr/script" name dir imports plugin_dir action auto view long \
|
||||||
button "浏览" action auto \
|
button "浏览" action auto \
|
||||||
button "返回" cb Last \
|
button "返回" cb Last \
|
||||||
|
feature display editor \
|
||||||
exports dir "" dir
|
exports dir "" dir
|
||||||
|
|
||||||
kit git "版本" private "ssh._route" _ "nfs.git" __ \
|
kit git "版本" private "ssh._route" _ "nfs.git" __ \
|
||||||
text "" name pod imports plugin_pod action auto \
|
text "" name pod imports plugin_pod action auto \
|
||||||
select "" values status values diff commit values values log values init action auto \
|
select "" values status values diff commit values values log values init action auto \
|
||||||
text "" name txt action auto \
|
text "" name txt action auto \
|
||||||
button "查看"
|
button "查看"
|
||||||
|
|
||||||
|
@ -468,8 +468,13 @@ var page = Page({
|
|||||||
var status = JSON.parse(line.status)
|
var status = JSON.parse(line.status)
|
||||||
kit.Selector(page.action, "fieldset.item", function(field, index) {
|
kit.Selector(page.action, "fieldset.item", function(field, index) {
|
||||||
var args = status[index].args
|
var args = status[index].args
|
||||||
kit.Selector(field, ".args", function(input, index) {
|
args = args.slice(kit.Selector(field, ".args", function(input, index) {
|
||||||
input.value = args[index]||""
|
return input.value = args[index]||""
|
||||||
|
}).length)
|
||||||
|
|
||||||
|
kit.List(args, function(arg) {
|
||||||
|
field.Plugin.Append({type: "text"}, "", arg)
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -445,3 +445,10 @@ fieldset pre code, fieldset code pre {
|
|||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fieldset.item>div.output>code.div {
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset.item>div.output>div.code div.number {
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1426,6 +1426,20 @@ function Output(plugin, type, msg, cb, target, option) {
|
|||||||
typeof cb == "function" && cb(msg)
|
typeof cb == "function" && cb(msg)
|
||||||
},
|
},
|
||||||
editor: function(msg, cb) {
|
editor: function(msg, cb) {
|
||||||
|
target.innerHTML = ""
|
||||||
|
output.onimport.meta._table(msg, msg.append)
|
||||||
|
if (msg.file) {
|
||||||
|
var code = kit.AppendChild(target, [{view: ["code", "table"], list: kit.List(msg.result, function(line, index) {
|
||||||
|
return {view: ["line", "tr"], list: [{view: ["number", "td", index+1]}, {view: ["code", "td", kit.Color(line)], style: {"white-space": "pre"}}], click: function(event) {
|
||||||
|
page.Sync("plugin_editor_file").set(msg.file[0])
|
||||||
|
page.Sync("plugin_editor_index").set(index+1)
|
||||||
|
page.Sync("plugin_editor_line").set(line)
|
||||||
|
page.Sync("plugin_editor_word").set(kit.CopyText())
|
||||||
|
}}
|
||||||
|
})}])
|
||||||
|
}
|
||||||
|
typeof cb == "function" && cb(msg)
|
||||||
|
return
|
||||||
(target.innerHTML = "", Editor(plugin.Run, plugin, option, target, target.clientWidth-40, 400, 10, msg))
|
(target.innerHTML = "", Editor(plugin.Run, plugin, option, target, target.clientWidth-40, 400, 10, msg))
|
||||||
},
|
},
|
||||||
canvas: function(msg, cb) {
|
canvas: function(msg, cb) {
|
||||||
|
@ -444,10 +444,11 @@ kit = toolkit = (function() {var kit = {__proto__: document,
|
|||||||
}
|
}
|
||||||
|
|
||||||
text = window.getSelection().toString()
|
text = window.getSelection().toString()
|
||||||
if (text == "") {return}
|
if (text == "") {return ""}
|
||||||
|
|
||||||
kit.History("txt", -1) && kit.History("txt", -1).data == text || kit.History("txt", -1, text) && document.execCommand("copy")
|
kit.History("txt", -1) && kit.History("txt", -1).data == text || kit.History("txt", -1, text) && document.execCommand("copy")
|
||||||
input && document.body.removeChild(input)
|
input && document.body.removeChild(input)
|
||||||
|
return text
|
||||||
},
|
},
|
||||||
DelText: function(target, start, count) {
|
DelText: function(target, start, count) {
|
||||||
target.value = target.value.substring(0, start)+target.value.substring(start+(count||target.value.length), target.value.length)
|
target.value = target.value.substring(0, start)+target.value.substring(start+(count||target.value.length), target.value.length)
|
||||||
@ -538,6 +539,8 @@ kit = toolkit = (function() {var kit = {__proto__: document,
|
|||||||
s = s.replace(/\033\[31m/g, "<span style='color:#f00'>")
|
s = s.replace(/\033\[31m/g, "<span style='color:#f00'>")
|
||||||
s = s.replace(/\033\[0m/g, "</span>")
|
s = s.replace(/\033\[0m/g, "</span>")
|
||||||
s = s.replace(/\033\[m/g, "</span>")
|
s = s.replace(/\033\[m/g, "</span>")
|
||||||
|
s = s.replace(/</g, "<")
|
||||||
|
s = s.replace(/>/g, ">")
|
||||||
return s
|
return s
|
||||||
},
|
},
|
||||||
Value: function() {
|
Value: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user