1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-04-06 22:32:14 +08:00
parent 81f69d34f8
commit 5bd4038d15
6 changed files with 31 additions and 23 deletions

View File

@ -141,11 +141,12 @@ func FileCmd(dir string) string {
return ice.Pulse.FileURI(kit.ExtChange(strings.Split(dir, nfs.DF)[0], nfs.GO))
}
func AddFileCmd(dir, key string) {
ice.Info.File[FileCmd(dir)] = key
if ls := strings.SplitN(path.Join(kit.Slice(kit.Split(FileCmd(dir), nfs.PS), 1, 4)...), mdb.AT, 2); len(ls) > 1 {
_ls := strings.Split(FileCmd(dir), mdb.AT+ls[1]+nfs.PS)
ice.Info.File[path.Join(nfs.REQUIRE_USR, path.Base(_ls[0]), _ls[1])] = key
ice.Info.Gomod[ls[0]] = ls[1]
} else {
ice.Info.File[FileCmd(dir)] = key
}
}
func GetFileCmd(dir string) string {

View File

@ -149,7 +149,9 @@ const (
ETC_CERT_PEM = "etc/cert/cert.pem"
SRC_DOCUMENT = "src/document/"
SRC_TEMPLATE = ice.SRC_TEMPLATE
USR_TOOLKITS = ice.USR_TOOLKITS
USR_ICEBERGS = ice.USR_ICEBERGS
USR_RELEASE = ice.USR_RELEASE
USR_PUBLISH = ice.USR_PUBLISH
USR_LOCAL = ice.USR_LOCAL
USR_LOCAL_WORK = ice.USR_LOCAL_WORK
@ -165,12 +167,14 @@ const (
USR_ICONS_VOLCANOS = "usr/icons/volcanos.png"
USR_ICONS = "usr/icons/"
INTSHELL = "/intshell/"
VOLCANOS = "/volcanos/"
VOLCANOS_PLUGIN = "/volcanos/plugin/"
REQUIRE_MODULES = "/require/modules/"
REQUIRE_USR = "/require/usr/"
REQUIRE_SRC = "/require/src/"
REQUIRE = "/require/"
VOLCANOS = "/volcanos/"
INTSHELL = "/intshell/"
PLUGIN = "/plugin/"
SHARE_LOCAL = "/share/local/"
PATHNAME = "pathname"
FILENAME = "filename"

View File

@ -334,9 +334,10 @@ func init() {
"gowork": {Name: "gowork name", Help: "工作区", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(cli.SYSTEM, cli.GO, "work", "init")
m.Cmd(cli.SYSTEM, cli.GO, "work", "use", ".")
DreamEach(m, m.Option(mdb.NAME), "", func(name string) {
m.Cmd(cli.SYSTEM, cli.GO, "work", "use", path.Join(ice.USR_LOCAL_WORK, name))
})
m.Cmd(cli.SYSTEM, cli.GO, "work", "use", nfs.USR_RELEASE)
m.Cmd(cli.SYSTEM, cli.GO, "work", "use", nfs.USR_ICEBERGS)
m.Cmd(cli.SYSTEM, cli.GO, "work", "use", nfs.USR_TOOLKITS)
DreamEach(m, m.Option(mdb.NAME), "", func(name string) { m.Cmd(cli.SYSTEM, cli.GO, "work", "use", path.Join(ice.USR_LOCAL_WORK, name)) })
}},
PUBLISH: {Name: "publish name", Hand: func(m *ice.Message, arg ...string) {
m.Option(ice.MSG_TITLE, kit.Keys(m.Option(ice.MSG_USERPOD0), m.Option(ice.MSG_USERPOD), m.CommandKey(), m.ActionKey()))

View File

@ -117,6 +117,7 @@ const ( // DIR
PLUGIN_LOCAL = "/plugin/local/"
PLUGIN_STORY = "/plugin/story/"
PLUGIN_TABLE_JS = "/plugin/table.js"
PKG_MOD = "/pkd/mod/"
ISH_PLUGED = ".ish/pluged/"
USR_INSTALL = "usr/install/"

View File

@ -103,18 +103,17 @@ func init() {
m.Cmdy(NAVIGATE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
}},
}), Hand: func(m *ice.Message, arg ...string) {
if kit.HasPrefix(arg[0], "/volcanos/", "/require/", ice.HTTP) {
if kit.HasPrefix(arg[0], ice.HTTP) && strings.Contains(arg[0], "/plugin/") && !strings.Contains(arg[0], "/volcanos/plugin/") {
arg[0] = strings.Replace(arg[0], "/plugin/", "/volcanos/plugin/", 1)
}
if kit.HasPrefix(arg[0], nfs.REQUIRE_SRC) {
m.Option(nfs.FILE, strings.Split(strings.TrimPrefix(arg[0], nfs.REQUIRE_SRC), "?")[0])
m.Option(nfs.PATH, nfs.SRC)
}
if kit.HasPrefix(arg[0], nfs.REQUIRE_USR) {
if kit.HasPrefix(arg[0], nfs.VOLCANOS, nfs.REQUIRE, ice.HTTP) {
if kit.HasPrefix(arg[0], ice.HTTP) && strings.Contains(arg[0], nfs.PLUGIN) && !strings.Contains(arg[0], nfs.VOLCANOS_PLUGIN) {
arg[0] = strings.Replace(arg[0], nfs.PLUGIN, nfs.VOLCANOS_PLUGIN, 1)
} else if kit.HasPrefix(arg[0], nfs.REQUIRE_SRC) {
m.Options(nfs.PATH, nfs.SRC, nfs.FILE, strings.Split(strings.TrimPrefix(arg[0], nfs.REQUIRE_SRC), "?")[0])
} else if kit.HasPrefix(arg[0], nfs.REQUIRE_USR) {
ls := kit.Split(arg[0], nfs.PS)
m.Option(nfs.FILE, strings.Split(strings.TrimPrefix(arg[0], nfs.REQUIRE_USR+ls[2]+nfs.PS), "?")[0])
m.Option(nfs.PATH, nfs.USR+ls[2]+nfs.PS)
m.Options(nfs.PATH, nfs.USR+ls[2]+nfs.PS, nfs.FILE, strings.Split(strings.TrimPrefix(arg[0], nfs.REQUIRE_USR+ls[2]+nfs.PS), "?")[0])
} else if kit.HasPrefix(arg[0], nfs.REQUIRE) {
ls := strings.Split(strings.Split(strings.TrimPrefix(arg[0], nfs.REQUIRE), "?")[0], nfs.SRC)
m.Options(nfs.PATH, kit.Join(kit.Slice(ls, 0, -1), nfs.PS)+nfs.SRC, nfs.FILE, kit.Select("", ls, -1))
}
m.Echo(m.Cmdx(web.SPIDE, ice.OPS, web.SPIDE_RAW, http.MethodGet, arg[0]))
m.Options("mode", "simple", lex.PARSE, kit.Ext(kit.ParseURL(arg[0]).Path))

14
info.go
View File

@ -297,16 +297,18 @@ func (m *Message) FileURI(dir string) string {
return dir
}
p := kit.Path("") + PS
pp := strings.Split(kit.Path(""), "usr/local/work")[0]
pod := m.Option(MSG_USERPOD)
if strings.Contains(dir, "/pkg/mod/") {
dir = strings.Split(dir, "/pkg/mod/")[1]
pp := strings.Split(kit.Path(""), USR_LOCAL_WORK)[0]
ppp := strings.Split(Info.Make.Path, USR_LOCAL_WORK)[0]
if strings.Contains(dir, PKG_MOD) {
dir = strings.Split(dir, PKG_MOD)[1]
} else if Info.Make.Path != "" && strings.HasPrefix(dir, Info.Make.Path) {
dir = strings.TrimPrefix(dir, Info.Make.Path)
} else if strings.HasPrefix(dir, p) {
dir = strings.TrimPrefix(dir, p)
} else if strings.Contains(p, "usr/local/work") && strings.HasPrefix(dir, pp) {
} else if pp != "" && strings.HasPrefix(dir, pp) {
dir = strings.TrimPrefix(dir, pp)
} else if ppp != "" && strings.HasPrefix(dir, ppp) {
dir = strings.TrimPrefix(dir, ppp)
} else if strings.HasPrefix(dir, ISH_PLUGED) {
dir = strings.TrimPrefix(dir, ISH_PLUGED)
}
@ -315,7 +317,7 @@ func (m *Message) FileURI(dir string) string {
} else if strings.HasPrefix(dir, USR_VOLCANOS) {
dir = strings.TrimPrefix(dir, USR)
} else {
dir = kit.MergeURL(path.Join(PS, REQUIRE, dir), POD, pod)
dir = kit.MergeURL(path.Join(PS, REQUIRE, dir), POD, m.Option(MSG_USERPOD))
}
if m.Option(MSG_USERWEB0) != "" {
dir = kit.MergeURL2(m.Option(MSG_USERWEB), dir)