forked from x/icebergs
opt some
This commit is contained in:
parent
faf74492ef
commit
b4ed74a874
@ -122,8 +122,8 @@ func IsOrderCmd(key string) bool { return key[0] == '/' || key[0] == '_' }
|
|||||||
func FileURI(dir string) string {
|
func FileURI(dir string) string {
|
||||||
if dir == "" {
|
if dir == "" {
|
||||||
return ""
|
return ""
|
||||||
} else if strings.Contains(dir, "/go/pkg/mod/") {
|
} else if strings.Contains(dir, "/pkg/mod/") {
|
||||||
dir = strings.Split(dir, "/go/pkg/mod/")[1]
|
dir = strings.Split(dir, "/pkg/mod/")[1]
|
||||||
} else if path.IsAbs(dir) {
|
} else if path.IsAbs(dir) {
|
||||||
if strings.HasPrefix(dir, kit.Path("")+nfs.PS) {
|
if strings.HasPrefix(dir, kit.Path("")+nfs.PS) {
|
||||||
dir = strings.TrimPrefix(dir, kit.Path("")+nfs.PS)
|
dir = strings.TrimPrefix(dir, kit.Path("")+nfs.PS)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package macos
|
package macos
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
@ -34,7 +32,7 @@ func CmdHashAction(arg ...string) ice.Actions {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(strings.TrimPrefix(file, ice.Info.Make.Path))
|
mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(ctx.FileURI(file))
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,name,icon,text,index,args", arg, 1), kit.Slice(arg, 2)))
|
}, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,name,icon,text,index,args", arg, 1), kit.Slice(arg, 2)))
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,15 @@ func _binpack_all(m *ice.Message) {
|
|||||||
for _, p := range []string{ice.ETC_MISS_SH, ice.ETC_INIT_SHY, ice.ETC_EXIT_SHY, ice.README_MD, ice.MAKEFILE, ice.LICENSE} {
|
for _, p := range []string{ice.ETC_MISS_SH, ice.ETC_INIT_SHY, ice.ETC_EXIT_SHY, ice.README_MD, ice.MAKEFILE, ice.LICENSE} {
|
||||||
_binpack_file(m, w, p)
|
_binpack_file(m, w, p)
|
||||||
}
|
}
|
||||||
list, cache := map[string]string{}, kit.Select(ice.USR_REQUIRE, m.Cmdx(cli.SYSTEM, GO, "env", "GOMODCACHE"))
|
list, cache := map[string]string{}, kit.GetValid(
|
||||||
const _mod_ = "/pkg/mod/"
|
func() string { return m.Cmdx(cli.SYSTEM, GO, "env", "GOMODCACHE") },
|
||||||
|
func() string {
|
||||||
|
return kit.Select(kit.HomePath("go")+nfs.PS, m.Cmdx(cli.SYSTEM, GO, "env", "GOPATH")) + "/pkg/mod/"
|
||||||
|
},
|
||||||
|
func() string {
|
||||||
|
return ice.USR_REQUIRE
|
||||||
|
},
|
||||||
|
)
|
||||||
for k := range ice.Info.File {
|
for k := range ice.Info.File {
|
||||||
switch ls := kit.Split(k, nfs.PS); ls[1] {
|
switch ls := kit.Split(k, nfs.PS); ls[1] {
|
||||||
case ice.SRC:
|
case ice.SRC:
|
||||||
@ -67,8 +74,7 @@ func _binpack_all(m *ice.Message) {
|
|||||||
list[path.Join(kit.Slice(ls, 1, -1)...)] = ""
|
list[path.Join(kit.Slice(ls, 1, -1)...)] = ""
|
||||||
default:
|
default:
|
||||||
p := path.Join(cache, path.Join(kit.Slice(ls, 1, -1)...))
|
p := path.Join(cache, path.Join(kit.Slice(ls, 1, -1)...))
|
||||||
_ls := strings.Split(strings.Split(p, _mod_)[1], nfs.PS)
|
list[path.Join(nfs.USR, strings.Split(ls[3], mdb.AT)[0], path.Join(kit.Slice(ls, 4)...))] = p
|
||||||
list[path.Join(nfs.USR, strings.Split(_ls[2], mdb.AT)[0], path.Join(kit.Slice(_ls, 3)...))] = p
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, k := range kit.SortedKey(list) {
|
for _, k := range kit.SortedKey(list) {
|
||||||
|
@ -346,8 +346,18 @@ func init() {
|
|||||||
m.RenderStatusBadRequest()
|
m.RenderStatusBadRequest()
|
||||||
} else if path.Join(arg[:3]...) == ice.Info.Make.Module && nfs.Exists(m, path.Join(arg[3:]...)) {
|
} else if path.Join(arg[:3]...) == ice.Info.Make.Module && nfs.Exists(m, path.Join(arg[3:]...)) {
|
||||||
m.RenderDownload(path.Join(arg[3:]...))
|
m.RenderDownload(path.Join(arg[3:]...))
|
||||||
|
} else if p := path.Join(kit.Split(arg[2], mdb.AT)[0], path.Join(arg[3:]...)); nfs.Exists(m, p) {
|
||||||
|
m.RenderDownload(p)
|
||||||
} else {
|
} else {
|
||||||
p := path.Join(kit.Select(ice.USR_REQUIRE, m.Cmdx(cli.SYSTEM, "go", "env", "GOMODCACHE")), path.Join(arg...))
|
p := path.Join(kit.GetValid(
|
||||||
|
func() string { return m.Cmdx(cli.SYSTEM, "go", "env", "GOMODCACHE") },
|
||||||
|
func() string {
|
||||||
|
return kit.Select(kit.HomePath("go")+nfs.PS, m.Cmdx(cli.SYSTEM, "go", "env", "GOPATH")) + "/pkg/mod/"
|
||||||
|
},
|
||||||
|
func() string {
|
||||||
|
return ice.USR_REQUIRE
|
||||||
|
},
|
||||||
|
), path.Join(arg...))
|
||||||
if !nfs.Exists(m, p) {
|
if !nfs.Exists(m, p) {
|
||||||
if p = path.Join(ice.USR_REQUIRE, path.Join(arg...)); !nfs.Exists(m, p) {
|
if p = path.Join(ice.USR_REQUIRE, path.Join(arg...)); !nfs.Exists(m, p) {
|
||||||
ls := strings.SplitN(path.Join(arg[:3]...), mdb.AT, 2)
|
ls := strings.SplitN(path.Join(arg[:3]...), mdb.AT, 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user