1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-01 19:19:24 +08:00
This commit is contained in:
shylinux 2021-10-19 12:26:10 +08:00
parent 6c5fc886d3
commit e8dacc85be
2 changed files with 17 additions and 1 deletions

View File

@ -56,6 +56,10 @@ func _cat_find(m *ice.Message, name string) io.ReadCloser {
return f
}
if m.Option(CAT_LOCAL) == ice.TRUE {
return nil
}
if b, ok := ice.Info.Pack[name]; ok {
m.Logs("binpack", len(b), name)
return NewReadCloser(bytes.NewBuffer(b))
@ -73,6 +77,9 @@ func _cat_show(m *ice.Message, name string) {
}
f := _cat_find(m, name)
if f == nil {
return
}
defer f.Close()
switch cb := m.Optionv(kit.Keycb(CAT)).(type) {
@ -113,6 +120,8 @@ const (
PATH = "path"
FILE = "file"
SIZE = "size"
CAT_LOCAL = "cat_local"
)
const CAT = "cat"

View File

@ -138,10 +138,13 @@ func init() {
if value["name"] == "release" {
value["name"] = "ice"
}
vs[value["name"]] = strings.Split(value["tags"], "-")[0]
}
})
m.Option(nfs.CAT_LOCAL, ice.TRUE)
m.GoToast(TAGS, func(toast func(string, int, int)) {
count, total := 0, len(vs)
toast(cli.BEGIN, count, total)
@ -150,6 +153,10 @@ func init() {
count++
toast(k, count, total)
if k == "ice" {
k = "release"
}
change := false
m.Option(nfs.DIR_ROOT, _repos_path(k))
mod := m.Cmdx(nfs.CAT, ice.GO_MOD, func(text string, line int) string {
@ -157,7 +164,7 @@ func init() {
if len(ls) < 2 || ls[1] == "=>" {
return text
}
if v, ok := vs[kit.Slice(strings.Split(ls[0], "/"), -1)[0]]; ok {
if v, ok := vs[kit.Slice(strings.Split(ls[0], "/"), -1)[0]]; ok && ls[1] != v {
text = ice.TB + ls[0] + ice.SP + v
change = true
}