mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
add some
This commit is contained in:
parent
4e4a9d80ba
commit
bb5fb5a908
@ -25,6 +25,7 @@ var _color_map = map[string]color.Color{
|
||||
PURPLE: color.RGBA{_DARK, 0, _DARK, _DARK},
|
||||
CYAN: color.RGBA{0, _DARK, _DARK, _DARK},
|
||||
WHITE: color.RGBA{_DARK, _DARK, _DARK, _DARK},
|
||||
SILVER: color.RGBA{0xC0, 0xC0, 0xC0, _DARK},
|
||||
}
|
||||
|
||||
func _parse_color(str string) color.Color {
|
||||
@ -60,6 +61,7 @@ const (
|
||||
GRAY = "gray"
|
||||
CYAN = "cyan"
|
||||
GREEN = "green"
|
||||
SILVER = "silver"
|
||||
PURPLE = "purple"
|
||||
YELLOW = "yellow"
|
||||
RANDOM = "random"
|
||||
|
@ -11,11 +11,11 @@ import (
|
||||
"shylinux.com/x/toolkits/logs"
|
||||
)
|
||||
|
||||
func _path_sep() string { return kit.Select(ice.DF, ";", strings.Contains(os.Getenv(PATH), ";")) }
|
||||
func _path_sep() string { return kit.Select(nfs.DF, ";", strings.Contains(os.Getenv(PATH), ";")) }
|
||||
func BinPath(arg ...string) string {
|
||||
list := []string{}
|
||||
push := func(p string) {
|
||||
kit.If(kit.IndexOf(list, p) == -1, func() { list = append(list, kit.ReplaceAll(p, "\\", ice.PS)) })
|
||||
kit.If(kit.IndexOf(list, p) == -1, func() { list = append(list, kit.ReplaceAll(p, "\\", nfs.PS)) })
|
||||
}
|
||||
kit.For(arg, func(p string) {
|
||||
list = append(list, kit.Path(p, ice.BIN), kit.Path(p, ice.USR_PUBLISH), kit.Path(p, ice.USR_LOCAL_BIN), kit.Path(p, ice.USR_LOCAL_GO_BIN))
|
||||
|
@ -60,7 +60,7 @@ func init() {
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, arg ...string) {
|
||||
dark := kit.IndexOf([]string{BLACK, "dark"}, m.Option(ice.MSG_THEME)) > -1
|
||||
m.Option(FG, kit.Select(kit.Select(BLACK, WHITE, dark), arg, 1))
|
||||
m.Option(FG, kit.Select(kit.Select(BLACK, SILVER, dark), arg, 1))
|
||||
m.Option(BG, kit.Select(kit.Select(WHITE, BLACK, dark), arg, 2))
|
||||
if m.IsCliUA() {
|
||||
_qrcode_cli(m, kit.Select(kit.Select(ice.Info.Make.Domain, ice.Info.Domain), arg, 0))
|
||||
|
@ -36,19 +36,19 @@ func _runtime_init(m *ice.Message) {
|
||||
}
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME), path.Base(kit.Path("")))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, USERNAME), kit.UserName())
|
||||
msg := m.Cmd(nfs.DIR, _system_find(m, os.Args[0]), "time,path,size,hash")
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, ice.BIN), msg.Append(nfs.PATH))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, nfs.SIZE), msg.Append(nfs.SIZE))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.HASH), msg.Append(mdb.HASH))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.TIME), msg.Append(mdb.TIME))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT), count+1)
|
||||
m.Conf(RUNTIME, mdb.META, "")
|
||||
m.Conf(RUNTIME, mdb.HASH, "")
|
||||
ice.Info.Hostname = m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME))
|
||||
ice.Info.Pathname = m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME))
|
||||
ice.Info.Username = m.Conf(RUNTIME, kit.Keys(BOOT, USERNAME))
|
||||
aaa.UserRoot(ice.Pulse, "", ice.Info.Username, aaa.ROOT, ice.OPS)
|
||||
aaa.UserRoot(ice.Pulse, "", ice.Info.Make.Username, aaa.TECH, ice.DEV)
|
||||
msg := m.Cmd(nfs.DIR, _system_find(m, os.Args[0]), "time,path,size,hash")
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.TIME), msg.Append(mdb.TIME))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.HASH), msg.Append(mdb.HASH))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, nfs.SIZE), msg.Append(nfs.SIZE))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, ice.BIN), msg.Append(nfs.PATH))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT), count+1)
|
||||
m.Conf(RUNTIME, mdb.META, "")
|
||||
m.Conf(RUNTIME, mdb.HASH, "")
|
||||
}
|
||||
func _runtime_hostinfo(m *ice.Message) {
|
||||
m.Push("nCPU", strings.Count(m.Cmdx(nfs.CAT, "/proc/cpuinfo"), "processor"))
|
||||
@ -155,31 +155,29 @@ func init() {
|
||||
}},
|
||||
API: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) > 1 {
|
||||
m.Cmdy(ctx.COMMAND, "web.code.inner").Push(ctx.ARGS, kit.Format(nfs.SplitPath(m, strings.TrimPrefix(m.Option(nfs.FILE), "/require/"))))
|
||||
m.Cmdy(ctx.COMMAND, "web.code.inner").Push(ctx.ARGS, kit.Format(nfs.SplitPath(m, m.Option(nfs.FILE))))
|
||||
return
|
||||
}
|
||||
ctx.DisplayStorySpide(m.Options(nfs.DIR_ROOT, nfs.PS), lex.PREFIX, kit.Fields(ctx.ACTION, m.ActionKey()))
|
||||
kit.For(ice.Info.Route, func(k, v string) { m.Push(nfs.PATH, k).Push(nfs.FILE, v) })
|
||||
m.StatusTimeCount().Sort(nfs.PATH)
|
||||
m.Sort(nfs.PATH).StatusTimeCount()
|
||||
}},
|
||||
CLI: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) > 1 {
|
||||
m.Cmdy(ctx.COMMAND, "web.code.inner").Push(ctx.ARGS, kit.Format(nfs.SplitPath(m, strings.TrimPrefix(m.Option(nfs.FILE), "/require/"))))
|
||||
m.Cmdy(ctx.COMMAND, "web.code.inner").Push(ctx.ARGS, kit.Format(nfs.SplitPath(m, m.Option(nfs.FILE))))
|
||||
return
|
||||
}
|
||||
ctx.DisplayStorySpide(m.Options(nfs.DIR_ROOT, "ice."), lex.PREFIX, kit.Fields(ctx.ACTION, m.ActionKey()), mdb.FIELD, mdb.NAME, lex.SPLIT, nfs.PT)
|
||||
kit.For(ice.Info.File, func(k, v string) { m.Push(nfs.FILE, k).Push(mdb.NAME, v) })
|
||||
m.StatusTimeCount().Sort(nfs.FILE)
|
||||
m.Sort(mdb.NAME).StatusTimeCount()
|
||||
}},
|
||||
CMD: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.OptionFields(ctx.INDEX, mdb.NAME, mdb.HELP, nfs.FILE)
|
||||
m.Cmdy(ctx.COMMAND, mdb.SEARCH, ctx.COMMAND).StatusTimeCount()
|
||||
}},
|
||||
"mod": {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.For(ice.Info.Gomod, func(k string, v ice.Any) {
|
||||
m.Push("mod", k)
|
||||
m.Push("url", v)
|
||||
})
|
||||
kit.For(ice.Info.Gomod, func(k string, v string) { m.Push(nfs.MODULE, k).Push(nfs.VERSION, v) })
|
||||
m.StatusTimeCount()
|
||||
}},
|
||||
ENV: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.For(os.Environ(), func(v string) {
|
||||
|
@ -18,8 +18,8 @@ import (
|
||||
)
|
||||
|
||||
func _path_split(ps string) []string {
|
||||
ps = kit.ReplaceAll(ps, "\\", ice.PS)
|
||||
return kit.Split(ps, ice.NL+kit.Select(ice.DF, ";", strings.Contains(ps, ";")), ice.NL)
|
||||
ps = kit.ReplaceAll(ps, "\\", nfs.PS)
|
||||
return kit.Split(ps, ice.NL+kit.Select(nfs.DF, ";", strings.Contains(ps, ";")), ice.NL)
|
||||
}
|
||||
func _system_cmd(m *ice.Message, arg ...string) *exec.Cmd {
|
||||
bin, env := "", kit.Simple(m.Optionv(CMD_ENV))
|
||||
@ -42,12 +42,12 @@ func _system_cmd(m *ice.Message, arg ...string) *exec.Cmd {
|
||||
m.Logs(FIND, "contexts cmd", bin)
|
||||
}
|
||||
}
|
||||
if bin == "" && !strings.Contains(arg[0], ice.PS) {
|
||||
if bin == "" && !strings.Contains(arg[0], nfs.PS) {
|
||||
if bin = _system_find(m, arg[0]); bin != "" {
|
||||
m.Logs(FIND, "systems cmd", bin)
|
||||
}
|
||||
}
|
||||
if bin == "" && !strings.Contains(arg[0], ice.PS) {
|
||||
if bin == "" && !strings.Contains(arg[0], nfs.PS) {
|
||||
m.Cmd(MIRRORS, CMD, arg[0])
|
||||
if bin = _system_find(m, arg[0]); bin != "" {
|
||||
m.Logs(FIND, "mirrors cmd", bin)
|
||||
@ -107,10 +107,10 @@ func _system_code(cmd *exec.Cmd) string {
|
||||
return kit.Select("1", "0", cmd.ProcessState != nil && cmd.ProcessState.Success())
|
||||
}
|
||||
func _system_find(m *ice.Message, bin string, dir ...string) string {
|
||||
if strings.Contains(bin, ice.DF) {
|
||||
if strings.Contains(bin, nfs.DF) {
|
||||
return bin
|
||||
}
|
||||
if strings.HasPrefix(bin, ice.PS) {
|
||||
if strings.HasPrefix(bin, nfs.PS) {
|
||||
return bin
|
||||
}
|
||||
if strings.HasPrefix(bin, nfs.PWD) {
|
||||
|
@ -60,9 +60,7 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
COMMAND: {Name: "command key auto", Help: "命令", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
TravelCmd(m, func(key, file, line string) {
|
||||
kit.If(strings.Contains(file, ice.ICEBERGS), func() { AddFileCmd(file, key) })
|
||||
})
|
||||
TravelCmd(m, func(key, file, line string) { AddFileCmd(file, key) })
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == m.CommandKey() || len(arg) > 1 && arg[1] != "" {
|
||||
@ -126,35 +124,35 @@ func FileURI(dir string) string {
|
||||
} else if strings.Contains(dir, "/go/pkg/mod/") {
|
||||
dir = strings.Split(dir, "/go/pkg/mod/")[1]
|
||||
} else if path.IsAbs(dir) {
|
||||
if strings.HasPrefix(dir, kit.Path("")+ice.PS) {
|
||||
dir = strings.TrimPrefix(dir, kit.Path("")+ice.PS)
|
||||
} else if ice.Info.Make.Path != "" && strings.HasPrefix(dir, ice.Info.Make.Path+ice.PS) {
|
||||
dir = strings.TrimPrefix(dir, ice.Info.Make.Path+ice.PS)
|
||||
if strings.HasPrefix(dir, kit.Path("")+nfs.PS) {
|
||||
dir = strings.TrimPrefix(dir, kit.Path("")+nfs.PS)
|
||||
} else if ice.Info.Make.Path != "" && strings.HasPrefix(dir, ice.Info.Make.Path+nfs.PS) {
|
||||
dir = strings.TrimPrefix(dir, ice.Info.Make.Path+nfs.PS)
|
||||
}
|
||||
} else if nfs.Exists(ice.Pulse, path.Join(ice.SRC, dir)) {
|
||||
dir = path.Join(ice.SRC, dir)
|
||||
}
|
||||
return path.Join(ice.PS, ice.REQUIRE, dir)
|
||||
return path.Join(nfs.PS, ice.REQUIRE, dir)
|
||||
}
|
||||
func FileCmd(dir string) string { return FileURI(kit.ExtChange(strings.Split(dir, ice.DF)[0], nfs.GO)) }
|
||||
func FileCmd(dir string) string { return 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(strings.Split(FileCmd(dir), ice.PS), 2, 5)...), ice.AT, 2); len(ls) > 1 {
|
||||
if ls := strings.SplitN(path.Join(kit.Slice(kit.Split(FileCmd(dir), nfs.PS), 1, 4)...), ice.AT, 2); len(ls) > 1 {
|
||||
ice.Info.Gomod[ls[0]] = ls[1]
|
||||
}
|
||||
}
|
||||
func GetFileCmd(dir string) string {
|
||||
if strings.HasPrefix(dir, ice.REQUIRE+ice.PS) {
|
||||
dir = ice.PS + dir
|
||||
if strings.HasPrefix(dir, ice.REQUIRE+nfs.PS) {
|
||||
dir = nfs.PS + dir
|
||||
} else if strings.HasPrefix(dir, ice.ISH_PLUGED) {
|
||||
dir = path.Join(ice.PS, ice.REQUIRE, strings.TrimPrefix(dir, ice.ISH_PLUGED))
|
||||
dir = path.Join(nfs.PS, ice.REQUIRE, strings.TrimPrefix(dir, ice.ISH_PLUGED))
|
||||
}
|
||||
for _, dir := range []string{dir, path.Join(ice.PS, ice.REQUIRE, ice.Info.Make.Module, dir), path.Join(ice.PS, ice.REQUIRE, ice.Info.Make.Module, ice.SRC, dir)} {
|
||||
for _, dir := range []string{dir, path.Join(nfs.PS, ice.REQUIRE, ice.Info.Make.Module, dir), path.Join(nfs.PS, ice.REQUIRE, ice.Info.Make.Module, ice.SRC, dir)} {
|
||||
if cmd, ok := ice.Info.File[FileCmd(dir)]; ok {
|
||||
return cmd
|
||||
}
|
||||
p := path.Dir(dir)
|
||||
if cmd, ok := ice.Info.File[FileCmd(path.Join(p, path.Base(p)+ice.PT+nfs.GO))]; ok {
|
||||
if cmd, ok := ice.Info.File[FileCmd(path.Join(p, path.Base(p)+nfs.PT+nfs.GO))]; ok {
|
||||
return cmd
|
||||
}
|
||||
}
|
||||
@ -162,7 +160,7 @@ func GetFileCmd(dir string) string {
|
||||
}
|
||||
func GetCmdFile(m *ice.Message, cmds string) (file string) {
|
||||
m.Search(cmds, func(key string, cmd *ice.Command) {
|
||||
if file = strings.TrimPrefix(FileURI(kit.Split(cmd.FileLine(), ice.DF)[0]), "/require/"); !nfs.Exists(m, file) {
|
||||
if file = strings.TrimPrefix(FileURI(kit.Split(cmd.FileLine(), nfs.DF)[0]), "/require/"); !nfs.Exists(m, file) {
|
||||
file = path.Join(ice.ISH_PLUGED, file)
|
||||
}
|
||||
})
|
||||
@ -173,8 +171,8 @@ func TravelCmd(m *ice.Message, cb func(key, file, line string)) *ice.Message {
|
||||
if IsOrderCmd(key) {
|
||||
return
|
||||
}
|
||||
if ls := kit.Split(cmd.FileLine(), ice.DF); len(ls) > 0 && cmd.Name != "" {
|
||||
cb(kit.Keys(s.Prefix(), key), strings.TrimPrefix(ls[0], kit.Path("")+ice.PS), kit.Select("1", ls, 1))
|
||||
if ls := kit.Split(cmd.FileLine(), nfs.DF); len(ls) > 0 && cmd.Name != "" {
|
||||
cb(kit.Keys(s.Prefix(), key), strings.TrimPrefix(ls[0], kit.Path("")+nfs.PS), kit.Select("1", ls, 1))
|
||||
}
|
||||
})
|
||||
return m
|
||||
|
@ -19,7 +19,7 @@ func FormatPretty(v ice.Any, i, n int) string {
|
||||
if n == 0 {
|
||||
list := []string{"{"}
|
||||
kit.For(v, func(k string, v ice.Any) {
|
||||
list = append(list, kit.Format("%q", k), ice.DF, FormatPretty(v, 0, 0), ice.FS)
|
||||
list = append(list, kit.Format("%q", k), nfs.DF, FormatPretty(v, 0, 0), ice.FS)
|
||||
})
|
||||
list = list[:len(list)-1]
|
||||
list = append(list, "}")
|
||||
@ -27,7 +27,7 @@ func FormatPretty(v ice.Any, i, n int) string {
|
||||
}
|
||||
list := []string{"{", ice.NL}
|
||||
kit.For(v, func(k string, v ice.Any) {
|
||||
list = append(list, strings.Repeat(ice.TB, i+1), kit.Format("%q", k), ice.DF)
|
||||
list = append(list, strings.Repeat(ice.TB, i+1), kit.Format("%q", k), nfs.DF)
|
||||
if i < n && !kit.IsIn(k, mdb.META) && !strings.HasPrefix(k, "_") {
|
||||
list = append(list, FormatPretty(v, i+1, n))
|
||||
} else {
|
||||
@ -72,14 +72,14 @@ func _config_format_list(m *ice.Message, v ice.Any) string {
|
||||
list := []string{"{", ice.NL}
|
||||
kit.For(v, func(k string, v ice.Any) {
|
||||
if k == mdb.HASH {
|
||||
list = append(list, ice.TB, kit.Format("%q", k), ice.DF, "{", ice.NL)
|
||||
list = append(list, ice.TB, kit.Format("%q", k), nfs.DF, "{", ice.NL)
|
||||
kit.For(v, func(k string, v ice.Any) {
|
||||
list = append(list, ice.TB, ice.TB, kit.Format("%q", k), ice.DF, kit.Format(v), ice.FS, ice.NL)
|
||||
list = append(list, ice.TB, ice.TB, kit.Format("%q", k), nfs.DF, kit.Format(v), ice.FS, ice.NL)
|
||||
})
|
||||
list = list[:len(list)-2]
|
||||
list = append(list, ice.TB, ice.NL, ice.TB, "}", ice.FS, ice.NL)
|
||||
} else {
|
||||
list = append(list, ice.TB, kit.Format("%q", k), ice.DF, kit.Format(v), ice.FS, ice.NL)
|
||||
list = append(list, ice.TB, kit.Format("%q", k), nfs.DF, kit.Format(v), ice.FS, ice.NL)
|
||||
}
|
||||
})
|
||||
list = list[:len(list)-2]
|
||||
|
@ -5,12 +5,13 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _context_list(m *ice.Message, sub *ice.Context, name string) {
|
||||
m.Travel(func(p *ice.Context, s *ice.Context) {
|
||||
if name != "" && name != ice.ICE && !strings.HasPrefix(s.Prefix(), name+ice.PT) {
|
||||
if name != "" && name != ice.ICE && !strings.HasPrefix(s.Prefix(), name+nfs.PT) {
|
||||
return
|
||||
}
|
||||
m.Push(mdb.NAME, s.Prefix()).Push(mdb.HELP, s.Help)
|
||||
@ -23,7 +24,7 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
CONTEXT: {Name: "context name=web action=context,command,config key auto", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(len(arg) == 0, func() { arg = append(arg, m.Source().Prefix()) })
|
||||
m.Search(arg[0]+ice.PT, func(p *ice.Context, s *ice.Context) {
|
||||
m.Search(arg[0]+nfs.PT, func(p *ice.Context, s *ice.Context) {
|
||||
msg := m.Spawn(s)
|
||||
defer m.Copy(msg)
|
||||
switch kit.Select(CONTEXT, arg, 1) {
|
||||
|
@ -17,11 +17,11 @@ type displayMessage interface {
|
||||
}
|
||||
|
||||
func isLocalFile(p string) bool {
|
||||
return !strings.HasPrefix(p, ice.PS) && !strings.HasPrefix(p, ice.HTTP)
|
||||
return !strings.HasPrefix(p, nfs.PS) && !strings.HasPrefix(p, ice.HTTP)
|
||||
}
|
||||
func Display(m displayMessage, file string, arg ...ice.Any) displayMessage {
|
||||
kit.If(file == "", func() { file = kit.Keys(kit.FileName(5), nfs.JS) })
|
||||
kit.If(isLocalFile(file), func() { file = path.Join(ice.PS, path.Join(path.Dir(FileURI(logs.FileLines(2))), file)) })
|
||||
kit.If(isLocalFile(file), func() { file = path.Join(nfs.PS, path.Join(path.Dir(FileURI(logs.FileLines(2))), file)) })
|
||||
return DisplayBase(m, file, arg...)
|
||||
}
|
||||
func DisplayTable(m displayMessage, arg ...ice.Any) displayMessage {
|
||||
|
@ -96,7 +96,7 @@ const SPLIT = "split"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SPLIT: {Name: "split path key auto", Help: "分词", Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 || strings.HasSuffix(arg[0], ice.PS) {
|
||||
if len(arg) == 0 || strings.HasSuffix(arg[0], nfs.PS) {
|
||||
m.Cmdy(nfs.DIR, arg)
|
||||
return
|
||||
}
|
||||
|
@ -41,12 +41,12 @@ func init() {
|
||||
m.Push(mdb.TIME, ls[0]+ice.SP+ls[1]).Push(mdb.ID, ls[2])
|
||||
m.Push(nfs.PATH, ice.USR_ICEBERGS)
|
||||
if i := strings.LastIndex(ls[5], ice.SP); strings.HasPrefix(ls[5][i+1:], ice.BASE) || strings.HasPrefix(ls[5][i+1:], ice.CORE) || strings.HasPrefix(ls[5][i+1:], ice.MISC) {
|
||||
m.Push(nfs.FILE, strings.TrimSpace(strings.Split(ls[5][i:], ice.DF)[0]))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], ice.DF)[1]))
|
||||
m.Push(nfs.FILE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[0]))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[1]))
|
||||
ls[5] = ls[5][:i]
|
||||
} else if strings.HasPrefix(ls[5][i+1:], ice.USR_ICEBERGS) {
|
||||
m.Push(nfs.FILE, strings.TrimPrefix(strings.TrimSpace(strings.Split(ls[5][i:], ice.DF)[0]), ice.USR_ICEBERGS))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], ice.DF)[1]))
|
||||
m.Push(nfs.FILE, strings.TrimPrefix(strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[0]), ice.USR_ICEBERGS))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[1]))
|
||||
ls[5] = ls[5][:i]
|
||||
} else {
|
||||
m.Push(nfs.FILE, "base/web/serve.go").Push(nfs.LINE, "62")
|
||||
@ -70,8 +70,8 @@ func init() {
|
||||
m.Push(mdb.TIME, ls[0]+ice.SP+ls[1]).Push(mdb.ID, ls[2])
|
||||
i := strings.LastIndex(ls[5], ice.SP)
|
||||
m.Push(nfs.PATH, ice.USR_ICEBERGS)
|
||||
m.Push(nfs.FILE, strings.TrimSpace(strings.Split(ls[5][i:], ice.DF)[0]))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], ice.DF)[1]))
|
||||
m.Push(nfs.FILE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[0]))
|
||||
m.Push(nfs.LINE, strings.TrimSpace(strings.Split(ls[5][i:], nfs.DF)[1]))
|
||||
m.Push(ctx.SHIP, ls[3]).Push(ctx.ACTION, ls[4]).Push(nfs.CONTENT, ls[5][:i])
|
||||
stats[ls[4]]++
|
||||
})
|
||||
|
@ -29,7 +29,7 @@ func init() {
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case mdb.NAME:
|
||||
m.Push(arg[0], kit.Split(m.Option(FILE), ice.PS))
|
||||
m.Push(arg[0], kit.Split(m.Option(FILE), nfs.PS))
|
||||
case nfs.FILE:
|
||||
m.Cmdy(nfs.DIR, kit.Select(nfs.PWD, arg, 1), nfs.PATH).RenameAppend(nfs.PATH, nfs.FILE).ProcessAgain()
|
||||
}
|
||||
|
@ -72,16 +72,16 @@ const (
|
||||
SCRIPT = "script"
|
||||
|
||||
REPOS = "repos"
|
||||
ORIGIN = "origin"
|
||||
REMOTE = "remote"
|
||||
ORIGIN = "origin"
|
||||
BRANCH = "branch"
|
||||
MASTER = "master"
|
||||
VERSION = "version"
|
||||
)
|
||||
const (
|
||||
HTML = ice.HTML
|
||||
SVG = ice.SVG
|
||||
CSS = ice.CSS
|
||||
SVG = ice.SVG
|
||||
JS = ice.JS
|
||||
GO = ice.GO
|
||||
SH = ice.SH
|
||||
@ -101,9 +101,9 @@ const (
|
||||
MP4 = "mp4"
|
||||
PDF = "pdf"
|
||||
|
||||
PWD = "./"
|
||||
PS = ice.PS
|
||||
PT = ice.PT
|
||||
DF = ice.DF
|
||||
PS = ice.PS
|
||||
PT = ice.PT
|
||||
)
|
||||
|
||||
const CAT = "cat"
|
||||
@ -113,10 +113,10 @@ func init() {
|
||||
CAT: {Name: "cat path auto", Help: "文件", Actions: ice.MergeActions(ice.Actions{ice.CTX_INIT: mdb.AutoConfig(SOURCE, kit.DictList(
|
||||
HTML, CSS, JS, GO, SH, PY, SHY, CSV, JSON, CONFIGURE, CONF, XML, YML, TXT, MD, strings.ToLower(ice.LICENSE), strings.ToLower(ice.MAKEFILE),
|
||||
))}), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 || strings.HasSuffix(arg[0], ice.PS) {
|
||||
if len(arg) == 0 || strings.HasSuffix(arg[0], PS) {
|
||||
m.Cmdy(DIR, arg)
|
||||
} else {
|
||||
_cat_list(m.Logs(FIND, m.OptionSimple(DIR_ROOT)), arg[0])
|
||||
_cat_list(m.Logs(FIND, m.OptionSimple(DIR_ROOT), FILE, arg[0]), arg[0])
|
||||
}
|
||||
}},
|
||||
})
|
||||
|
@ -31,7 +31,7 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
|
||||
}
|
||||
}
|
||||
for _, s := range ls {
|
||||
if s.Name() == ice.PT || s.Name() == ".." || strings.HasPrefix(s.Name(), ice.PT) && dir_type != TYPE_ALL {
|
||||
if s.Name() == PT || s.Name() == ".." || strings.HasPrefix(s.Name(), PT) && dir_type != TYPE_ALL {
|
||||
continue
|
||||
}
|
||||
p, pp := path.Join(root, dir, s.Name()), path.Join(dir, s.Name())
|
||||
@ -61,11 +61,11 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
|
||||
m.Push(field, strings.Repeat("| ", level-1)+"|-"+s.Name())
|
||||
}
|
||||
case FULL:
|
||||
m.Push(field, p+kit.Select("", ice.PS, isDir))
|
||||
m.Push(field, p+kit.Select("", PS, isDir))
|
||||
case PATH:
|
||||
m.Push(field, pp+kit.Select("", ice.PS, isDir))
|
||||
m.Push(field, pp+kit.Select("", PS, isDir))
|
||||
case FILE:
|
||||
m.Push(field, s.Name()+kit.Select("", ice.PS, isDir))
|
||||
m.Push(field, s.Name()+kit.Select("", PS, isDir))
|
||||
case NAME:
|
||||
m.Push(field, s.Name())
|
||||
case SIZE:
|
||||
@ -125,8 +125,10 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
|
||||
}
|
||||
|
||||
const (
|
||||
SRC = "src/"
|
||||
USR = "usr/"
|
||||
PWD = "./"
|
||||
SRC = "src/"
|
||||
USR = "usr/"
|
||||
REQUIRE = "/require/"
|
||||
|
||||
TYPE_ALL = "all"
|
||||
TYPE_CAT = "cat"
|
||||
@ -175,8 +177,7 @@ func init() {
|
||||
TRASH: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(TRASH, mdb.CREATE, m.Option(PATH)) }},
|
||||
}, Hand: func(m *ice.Message, arg ...string) {
|
||||
root, dir := kit.Select(PWD, m.Option(DIR_ROOT)), kit.Select(PWD, arg, 0)
|
||||
kit.If(strings.HasPrefix(dir, ice.PS), func() { root, dir = ice.PS, strings.TrimPrefix(dir, ice.PS) })
|
||||
kit.If(root == ice.PS && dir == ice.PS, func() { root, dir = PWD, PWD })
|
||||
kit.If(strings.HasPrefix(dir, PS), func() { root = "" })
|
||||
if !aaa.Right(m, path.Join(root, dir)) {
|
||||
return
|
||||
}
|
||||
@ -201,15 +202,21 @@ func Relative(m *ice.Message, p string) string {
|
||||
return p
|
||||
}
|
||||
func SplitPath(m *ice.Message, p string) []string {
|
||||
line := kit.Select("1", strings.Split(p, ice.DF), 1)
|
||||
p = strings.TrimPrefix(p, kit.Path("")+ice.PS)
|
||||
p = strings.Split(p, ice.DF)[0]
|
||||
if ls := kit.Split(kit.Select(ice.SRC_MAIN_GO, p), ice.PS); len(ls) == 1 {
|
||||
if kit.HasPrefix(p, ice.REQUIRE_SRC, ice.REQUIRE_USR) {
|
||||
p = strings.TrimPrefix(p, REQUIRE)
|
||||
} else if kit.HasPrefix(p, REQUIRE) {
|
||||
ls := kit.Split(p, PS)
|
||||
return []string{ice.USR_REQUIRE + path.Join(ls[1:4]...) + PS, path.Join(ls[4:]...)}
|
||||
}
|
||||
line := kit.Select("1", strings.Split(p, DF), 1)
|
||||
p = strings.TrimPrefix(p, kit.Path("")+PS)
|
||||
p = strings.Split(p, DF)[0]
|
||||
if ls := kit.Split(kit.Select(ice.SRC_MAIN_GO, p), PS); len(ls) == 1 {
|
||||
return []string{PWD, ls[0], line}
|
||||
} else if ls[0] == ice.USR {
|
||||
return []string{strings.Join(ls[:2], ice.PS) + ice.PS, strings.Join(ls[2:], ice.PS), line}
|
||||
return []string{strings.Join(ls[:2], PS) + PS, strings.Join(ls[2:], PS), line}
|
||||
} else {
|
||||
return []string{strings.Join(ls[:1], ice.PS) + ice.PS, strings.Join(ls[1:], ice.PS), line}
|
||||
return []string{strings.Join(ls[:1], PS) + PS, strings.Join(ls[1:], PS), line}
|
||||
}
|
||||
}
|
||||
func Dir(m *ice.Message, field string) *ice.Message {
|
||||
|
@ -20,8 +20,8 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
GREP: {Name: "grep word file path auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(mdb.VALUE, arg[0], CMD_DIR, kit.Select("", arg, 2))
|
||||
kit.For(strings.Split(m.Cmdx("cli.system", GREP, "--exclude=.[a-z]*", "--exclude-dir=.[a-z]*", "-rni", arg[0], kit.Select(ice.PT, arg, 1)), ice.NL), func(s string) {
|
||||
if ls := strings.SplitN(s, ice.DF, 3); len(ls) > 2 {
|
||||
kit.For(strings.Split(m.Cmdx("cli.system", GREP, "--exclude=.[a-z]*", "--exclude-dir=.[a-z]*", "-rni", arg[0], kit.Select(PT, arg, 1)), ice.NL), func(s string) {
|
||||
if ls := strings.SplitN(s, DF, 3); len(ls) > 2 {
|
||||
m.Push(FILE, strings.TrimPrefix(ls[0], PWD)).Push(LINE, ls[1]).Push(mdb.TEXT, ls[2])
|
||||
}
|
||||
})
|
||||
|
@ -17,7 +17,7 @@ const HEX = "hex"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{HEX: {Name: "hex path compress=raw,gzip,zlib size auto", Help: "二进制", Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 || arg[0] == "" || strings.HasSuffix(arg[0], ice.PS) {
|
||||
if len(arg) == 0 || arg[0] == "" || strings.HasSuffix(arg[0], PS) {
|
||||
m.Cmdy(DIR, kit.Slice(arg, 0, 1))
|
||||
return
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func init() {
|
||||
_tar_list(m, m.Option(PATH), func(h *tar.Header, r *tar.Reader, i int) {
|
||||
if h.Name == m.Option(FILE) || m.Option(FILE) == "" {
|
||||
p := path.Join(path.Dir(m.Option(PATH)), h.Name)
|
||||
if strings.HasSuffix(h.Name, ice.PS) {
|
||||
if strings.HasSuffix(h.Name, PS) {
|
||||
MkdirAll(m, p)
|
||||
return
|
||||
}
|
||||
@ -75,7 +75,7 @@ func init() {
|
||||
})
|
||||
}},
|
||||
}, mdb.PageListAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 || strings.HasSuffix(arg[0], ice.PS) {
|
||||
if len(arg) == 0 || strings.HasSuffix(arg[0], PS) {
|
||||
m.Cmdy(DIR, arg)
|
||||
return
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ func (f *Frame) change(m *ice.Message, ls []string) []string {
|
||||
target, ls = ls[0], ls[1:]
|
||||
}
|
||||
kit.If(target == "~", func() { target = "" })
|
||||
m.Spawn(f.target).Search(target+ice.PT, func(p *ice.Context, s *ice.Context) { f.target = s })
|
||||
m.Spawn(f.target).Search(target+nfs.PT, func(p *ice.Context, s *ice.Context) { f.target = s })
|
||||
}
|
||||
return ls
|
||||
}
|
||||
@ -163,7 +163,7 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
f.scan(m, STDIO, "")
|
||||
default:
|
||||
if m.Option(ice.MSG_SCRIPT) != "" {
|
||||
ls := kit.Split(m.Option(ice.MSG_SCRIPT), ice.PS)
|
||||
ls := kit.Split(m.Option(ice.MSG_SCRIPT), nfs.PS)
|
||||
for i := len(ls) - 1; i > 0; i-- {
|
||||
if p := path.Join(path.Join(ls[:i]...), f.source); nfs.Exists(m, p) {
|
||||
f.source = p
|
||||
@ -218,7 +218,7 @@ func init() {
|
||||
}},
|
||||
TARGET: {Name: "target name run", Help: "当前模块", Hand: func(m *ice.Message, arg ...string) {
|
||||
if f, ok := m.Target().Server().(*Frame); ok {
|
||||
m.Search(arg[0]+ice.PT, func(p *ice.Context, s *ice.Context) { f.target = s })
|
||||
m.Search(arg[0]+nfs.PT, func(p *ice.Context, s *ice.Context) { f.target = s })
|
||||
f.prompt(m)
|
||||
}
|
||||
}},
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
"shylinux.com/x/toolkits/logs"
|
||||
)
|
||||
@ -46,9 +47,9 @@ const (
|
||||
)
|
||||
|
||||
func UDPAddr(m *ice.Message, host, port string) *net.UDPAddr {
|
||||
if addr, e := net.ResolveUDPAddr(UDP4, host+ice.DF+port); !m.Warn(e, ice.ErrNotValid, host, port, logs.FileLineMeta(2)) {
|
||||
if addr, e := net.ResolveUDPAddr(UDP4, host+nfs.DF+port); !m.Warn(e, ice.ErrNotValid, host, port, logs.FileLineMeta(2)) {
|
||||
return addr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func HostPort(host, port string) string { return host + ice.DF + port }
|
||||
func HostPort(host, port string) string { return host + nfs.DF + port }
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -28,7 +29,7 @@ func (c *Conn) Write(b []byte) (int, error) {
|
||||
func (c *Conn) Close() error { return c.Conn.Close() }
|
||||
|
||||
func _client_dial(m *ice.Message, arg ...string) {
|
||||
c, e := net.Dial(TCP, m.Option(HOST)+ice.DF+m.Option(PORT))
|
||||
c, e := net.Dial(TCP, m.Option(HOST)+nfs.DF+m.Option(PORT))
|
||||
c = &Conn{Conn: c, m: m, s: &Stat{}}
|
||||
defer kit.If(e == nil, func() { c.Close() })
|
||||
switch cb := m.OptionCB("").(type) {
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -18,8 +19,8 @@ func _host_list(m *ice.Message, name string) {
|
||||
}
|
||||
if ips, e := v.Addrs(); m.Assert(e) {
|
||||
for _, x := range ips {
|
||||
ip := strings.Split(x.String(), ice.PS)
|
||||
if strings.Contains(ip[0], ice.DF) || len(ip) == 0 {
|
||||
ip := strings.Split(x.String(), nfs.PS)
|
||||
if strings.Contains(ip[0], nfs.DF) || len(ip) == 0 {
|
||||
continue
|
||||
}
|
||||
m.Push(mdb.INDEX, v.Index).Push(mdb.NAME, v.Name).Push(aaa.IP, ip[0]).Push("mask", ip[1]).Push("hard", v.HardwareAddr.String())
|
||||
@ -76,7 +77,7 @@ func init() {
|
||||
m.Echo(arg[0])
|
||||
}},
|
||||
GATEWAY: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Push(aaa.IP, kit.Keys(kit.Slice(strings.Split(m.Cmdv(HOST, aaa.IP), ice.PT), 0, 3), "1"))
|
||||
m.Push(aaa.IP, kit.Keys(kit.Slice(strings.Split(m.Cmdv(HOST, aaa.IP), nfs.PT), 0, 3), "1"))
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.TEXT), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
_host_list(m, kit.Select("", arg, 0))
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -28,7 +29,7 @@ func (l Listener) Close() error {
|
||||
}
|
||||
|
||||
func _server_listen(m *ice.Message, arg ...string) {
|
||||
l, e := net.Listen(TCP, m.Option(HOST)+ice.DF+m.Option(PORT))
|
||||
l, e := net.Listen(TCP, m.Option(HOST)+nfs.DF+m.Option(PORT))
|
||||
l = &Listener{Listener: l, m: m, h: mdb.HashCreate(m, arg, kit.Dict(mdb.TARGET, l), STATUS, kit.Select(ERROR, OPEN, e == nil), ERROR, kit.Format(e)), s: &Stat{}}
|
||||
defer kit.If(e == nil, func() { l.Close() })
|
||||
switch cb := m.OptionCB("").(type) {
|
||||
|
@ -20,9 +20,9 @@ func _cache_name(m *ice.Message, h string) string { return path.Join(ice.VAR_FIL
|
||||
func _cache_mime(m *ice.Message, mime, name string) string {
|
||||
if mime == ApplicationOctet {
|
||||
if kit.ExtIsImage(name) {
|
||||
mime = IMAGE + ice.PS + kit.Ext(name)
|
||||
mime = IMAGE + nfs.PS + kit.Ext(name)
|
||||
} else if kit.ExtIsVideo(name) {
|
||||
mime = VIDEO + ice.PS + kit.Ext(name)
|
||||
mime = VIDEO + nfs.PS + kit.Ext(name)
|
||||
}
|
||||
} else if mime == "" {
|
||||
return kit.Ext(name)
|
||||
@ -130,7 +130,7 @@ func init() {
|
||||
ice.RENDER_DOWNLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(_share_link(m, kit.Select(arg[0], arg, 1), ice.POD, m.Option(ice.MSG_USERPOD), "filename", kit.Select("", arg[0], len(arg) > 1)))
|
||||
}},
|
||||
ice.PS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelectDetail(m, arg[0], func(value ice.Map) {
|
||||
if kit.Format(value[nfs.FILE]) == "" {
|
||||
m.RenderResult(value[mdb.TEXT])
|
||||
@ -183,9 +183,9 @@ func Download(m *ice.Message, link string, cb func(count, total, value int)) *ic
|
||||
return m.Cmdy(Prefix(SPIDE), ice.DEV, SPIDE_CACHE, http.MethodGet, link, cb)
|
||||
}
|
||||
func PushDisplay(m *ice.Message, mime, name, link string) {
|
||||
if strings.HasPrefix(mime, IMAGE+ice.PS) || kit.ExtIsImage(name) {
|
||||
if strings.HasPrefix(mime, IMAGE+nfs.PS) || kit.ExtIsImage(name) {
|
||||
m.PushImages(nfs.FILE, link)
|
||||
} else if strings.HasPrefix(mime, VIDEO+ice.PS) || kit.ExtIsImage(name) {
|
||||
} else if strings.HasPrefix(mime, VIDEO+nfs.PS) || kit.ExtIsImage(name) {
|
||||
m.PushVideos(nfs.FILE, link)
|
||||
} else {
|
||||
m.PushDownload(nfs.FILE, name, link)
|
||||
|
@ -76,7 +76,7 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
|
||||
func CookieName(url string) string { return ice.MSG_SESSID + "_" + kit.ParseURLMap(url)[tcp.PORT] }
|
||||
func RenderCookie(m *ice.Message, value string, arg ...string) { // name path expire
|
||||
http.SetCookie(m.W, &http.Cookie{Value: value, Name: kit.Select(CookieName(m.Option(ice.MSG_USERWEB)), arg, 0),
|
||||
Path: kit.Select(ice.PS, arg, 1), Expires: time.Now().Add(kit.Duration(kit.Select(mdb.MONTH, arg, 2)))})
|
||||
Path: kit.Select(nfs.PS, arg, 1), Expires: time.Now().Add(kit.Duration(kit.Select(mdb.MONTH, arg, 2)))})
|
||||
}
|
||||
func RenderType(w http.ResponseWriter, name, mime string) {
|
||||
if mime == "" {
|
||||
|
@ -41,17 +41,17 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
||||
}
|
||||
if ip := r.Header.Get(X_REAL_IP); ip != "" {
|
||||
if r.Header.Set(ice.MSG_USERIP, ip); r.Header.Get(X_REAL_PORT) != "" {
|
||||
r.Header.Set(ice.MSG_USERADDR, ip+ice.DF+r.Header.Get(X_REAL_PORT))
|
||||
r.Header.Set(ice.MSG_USERADDR, ip+nfs.DF+r.Header.Get(X_REAL_PORT))
|
||||
}
|
||||
} else if ip := r.Header.Get(X_FORWARDED_FOR); ip != "" {
|
||||
r.Header.Set(ice.MSG_USERIP, kit.Split(ip)[0])
|
||||
} else if strings.HasPrefix(r.RemoteAddr, "[") {
|
||||
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, "]")[0][1:])
|
||||
} else {
|
||||
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, ice.DF)[0])
|
||||
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, nfs.DF)[0])
|
||||
}
|
||||
if m.Logs(r.Header.Get(ice.MSG_USERIP), r.Method, r.URL.String()); r.Method == http.MethodGet {
|
||||
if msg := m.Spawn(w, r).Options(ice.MSG_USERUA, r.UserAgent()); path.Join(r.URL.Path) == ice.PS {
|
||||
if msg := m.Spawn(w, r).Options(ice.MSG_USERUA, r.UserAgent()); path.Join(r.URL.Path) == nfs.PS {
|
||||
return !Render(RenderMain(msg), msg.Option(ice.MSG_OUTPUT), kit.List(msg.Optionv(ice.MSG_ARGS))...)
|
||||
} else if p := path.Join(kit.Select(ice.USR_VOLCANOS, ice.USR_INTSHELL, msg.IsCliUA()), r.URL.Path); nfs.Exists(msg, p) {
|
||||
return !Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||
@ -63,7 +63,7 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
||||
_log := func(level string, arg ...ice.Any) *ice.Message { return m.Logs(strings.Title(level), arg...) }
|
||||
if u, e := url.Parse(r.Header.Get(Referer)); e == nil {
|
||||
add := func(k, v string) { _log(nfs.PATH, k, m.Option(k, v)) }
|
||||
switch arg := strings.Split(strings.TrimPrefix(u.Path, ice.PS), ice.PS); arg[0] {
|
||||
switch arg := strings.Split(strings.TrimPrefix(u.Path, nfs.PS), nfs.PS); arg[0] {
|
||||
case CHAT:
|
||||
kit.For(arg[1:], func(k, v string) { add(k, v) })
|
||||
case SHARE:
|
||||
@ -85,7 +85,7 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
||||
m.Options(ice.MSG_USERUA, r.Header.Get(UserAgent), ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP))
|
||||
m.Options(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB)))))
|
||||
kit.If(m.Optionv(ice.MSG_CMDS) == nil, func() {
|
||||
kit.If(strings.TrimPrefix(r.URL.Path, key), func(p string) { m.Optionv(ice.MSG_CMDS, strings.Split(p, ice.PS)) })
|
||||
kit.If(strings.TrimPrefix(r.URL.Path, key), func(p string) { m.Optionv(ice.MSG_CMDS, strings.Split(p, nfs.PS)) })
|
||||
})
|
||||
defer func() { Render(m, m.Option(ice.MSG_OUTPUT), kit.List(m.Optionv(ice.MSG_ARGS))...) }()
|
||||
if cmds, ok := _serve_auth(m, key, kit.Simple(m.Optionv(ice.MSG_CMDS)), w, r); ok {
|
||||
@ -177,9 +177,9 @@ func init() {
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,status,name,proto,host,port"), mdb.ClearOnExitHashAction())},
|
||||
})
|
||||
ice.AddMergeAction(func(c *ice.Context, key string, cmd *ice.Command, sub string, action *ice.Action) {
|
||||
if strings.HasPrefix(sub, ice.PS) {
|
||||
if strings.HasPrefix(sub, nfs.PS) {
|
||||
kit.If(action.Hand == nil, func() { action.Hand = cmd.Hand })
|
||||
sub = kit.Select(P(key, sub), PP(key, sub), strings.HasSuffix(sub, ice.PS))
|
||||
sub = kit.Select(P(key, sub), PP(key, sub), strings.HasSuffix(sub, nfs.PS))
|
||||
c.Commands[sub] = &ice.Command{Name: kit.Select(cmd.Name, action.Name), Actions: ctx.CmdAction(), Hand: action.Hand}
|
||||
}
|
||||
})
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func _share_link(m *ice.Message, p string, arg ...ice.Any) string {
|
||||
return tcp.PublishLocalhost(m, MergeLink(m, kit.Select("", PP(SHARE, LOCAL), !strings.HasPrefix(p, ice.PS) && !strings.HasPrefix(p, HTTP))+p, arg...))
|
||||
return tcp.PublishLocalhost(m, MergeLink(m, kit.Select("", PP(SHARE, LOCAL), !strings.HasPrefix(p, nfs.PS) && !strings.HasPrefix(p, HTTP))+p, arg...))
|
||||
}
|
||||
func _share_cache(m *ice.Message, arg ...string) {
|
||||
if pod := m.Option(ice.POD); ctx.PodCmd(m, CACHE, arg[0]) {
|
||||
@ -72,7 +72,7 @@ func init() {
|
||||
LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.EchoQRCode(m.Cmd(SHARE, mdb.CREATE, mdb.TYPE, LOGIN).Option(mdb.LINK)).ProcessInner()
|
||||
}},
|
||||
ice.PS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Warn(len(arg) == 0 || arg[0] == "", ice.ErrNotValid, SHARE) {
|
||||
return
|
||||
}
|
||||
@ -83,7 +83,7 @@ func init() {
|
||||
}
|
||||
switch msg.Append(mdb.TYPE) {
|
||||
case LOGIN:
|
||||
m.RenderRedirect(ice.PS, ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
|
||||
m.RenderRedirect(nfs.PS, ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
|
||||
default:
|
||||
RenderMain(m)
|
||||
}
|
||||
@ -116,7 +116,7 @@ func IsNotValidShare(m *ice.Message, time string) bool {
|
||||
}
|
||||
func ShareLocalFile(m *ice.Message, arg ...string) {
|
||||
p := path.Join(arg...)
|
||||
switch ls := strings.Split(p, ice.PS); ls[0] {
|
||||
switch ls := strings.Split(p, nfs.PS); ls[0] {
|
||||
case ice.ETC, ice.VAR:
|
||||
if m.Warn(m.Option(ice.MSG_USERROLE) == aaa.VOID, ice.ErrNotRight, p) {
|
||||
return
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
"shylinux.com/x/icebergs/base/gdb"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/ssh"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
"shylinux.com/x/icebergs/misc/websocket"
|
||||
@ -45,7 +46,7 @@ func _space_dial(m *ice.Message, dev, name string, arg ...string) {
|
||||
}
|
||||
func _space_fork(m *ice.Message) {
|
||||
addr := kit.Select(m.R.RemoteAddr, m.R.Header.Get(ice.MSG_USERADDR))
|
||||
name := kit.ReplaceAll(kit.Select(addr, m.Option(mdb.NAME)), "[", "_", "]", "_", ice.DF, "_", ice.PT, "_")
|
||||
name := kit.ReplaceAll(kit.Select(addr, m.Option(mdb.NAME)), "[", "_", "]", "_", nfs.DF, "_", nfs.PT, "_")
|
||||
args := kit.Simple(mdb.TYPE, kit.Select(WORKER, m.Option(mdb.TYPE)), mdb.NAME, name, mdb.TEXT, kit.Select(addr, m.Option(mdb.TEXT)), m.OptionSimple(cli.DAEMON, ice.MSG_USERUA))
|
||||
if c, e := websocket.Upgrade(m.W, m.R); !m.Warn(e) {
|
||||
gdb.Go(m, func() {
|
||||
@ -129,7 +130,7 @@ func _space_send(m *ice.Message, name string, arg ...string) {
|
||||
})
|
||||
h := mdb.HashCreate(m.Spawn(), mdb.TYPE, tcp.SEND, mdb.NAME, kit.Keys(name, m.Target().ID()), mdb.TEXT, kit.Join(arg, ice.SP), kit.Dict(mdb.TARGET, done))
|
||||
defer mdb.HashRemove(m, mdb.HASH, h)
|
||||
if target := kit.Split(name, ice.PT, ice.PT); mdb.HashSelectDetail(m, target[0], func(value ice.Map) {
|
||||
if target := kit.Split(name, nfs.PT, nfs.PT); mdb.HashSelectDetail(m, target[0], func(value ice.Map) {
|
||||
if c, ok := value[mdb.TARGET].(*websocket.Conn); !m.Warn(!ok, ice.ErrNotValid, mdb.TARGET) {
|
||||
kit.For(m.Optionv(ice.MSG_OPTS), func(k string) { m.Optionv(k, m.Optionv(k)) })
|
||||
_space_echo(m.Set(ice.MSG_DETAIL, arg...), []string{h}, target, c)
|
||||
@ -196,7 +197,7 @@ func init() {
|
||||
ctx.ProcessOpen(m, m.MergePod(m.Option(mdb.NAME), arg))
|
||||
}
|
||||
}},
|
||||
ice.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text", ctx.ACTION, OPEN, REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000)), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 2 {
|
||||
mdb.HashSelect(m, arg...).Sort("").Table(func(value ice.Maps) { m.PushButton(kit.Select(OPEN, LOGIN, value[mdb.TYPE] == LOGIN), mdb.REMOVE) })
|
||||
|
@ -35,13 +35,13 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
f.ServeMux = http.NewServeMux()
|
||||
msg := m.Spawn(c)
|
||||
if pf, ok := p.Server().(*Frame); ok && pf.ServeMux != nil {
|
||||
route := ice.PS + c.Name + ice.PS
|
||||
route := nfs.PS + c.Name + nfs.PS
|
||||
msg.Log("route", "%s <= %s", p.Name, route)
|
||||
pf.Handle(route, http.StripPrefix(path.Dir(route), f))
|
||||
list[c] = path.Join(list[p], route)
|
||||
}
|
||||
for key, cmd := range c.Commands {
|
||||
if key[:1] != ice.PS {
|
||||
if key[:1] != nfs.PS {
|
||||
continue
|
||||
}
|
||||
func(key string, cmd *ice.Command) {
|
||||
@ -75,7 +75,7 @@ var Index = &ice.Context{Name: WEB, Help: "网络模块"}
|
||||
|
||||
func init() { ice.Index.Register(Index, &Frame{}, BROAD, SERVE, SPACE, DREAM, CACHE, SPIDE, SHARE) }
|
||||
|
||||
func ApiAction(arg ...string) ice.Actions { return ice.Actions{kit.Select(ice.PS, arg, 0): {}} }
|
||||
func ApiAction(arg ...string) ice.Actions { return ice.Actions{kit.Select(nfs.PS, arg, 0): {}} }
|
||||
func Prefix(arg ...string) string {
|
||||
for i, k := range arg {
|
||||
switch k {
|
||||
@ -86,5 +86,5 @@ func Prefix(arg ...string) string {
|
||||
return kit.Keys(WEB, arg)
|
||||
}
|
||||
|
||||
func P(arg ...string) string { return path.Join(ice.PS, path.Join(arg...)) }
|
||||
func PP(arg ...string) string { return P(arg...) + ice.PS }
|
||||
func P(arg ...string) string { return path.Join(nfs.PS, path.Join(arg...)) }
|
||||
func PP(arg ...string) string { return P(arg...) + nfs.PS }
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -233,7 +234,7 @@ func (s *Expr) cals(m *ice.Message, arg ...string) Any {
|
||||
return true
|
||||
case BEGIN:
|
||||
p := ""
|
||||
kit.If(strings.Contains(s.gets(-1), ice.PT), func() { p = kit.Split(s.gets(-1), ice.PT)[0] })
|
||||
kit.If(strings.Contains(s.gets(-1), nfs.PT), func() { p = kit.Split(s.gets(-1), nfs.PT)[0] })
|
||||
switch t := s.getv(m, -1).(type) {
|
||||
case Map:
|
||||
s.pops(1, Dict{s.ktv(m, t, p)})
|
||||
@ -296,7 +297,7 @@ func (s *Expr) cals(m *ice.Message, arg ...string) Any {
|
||||
if len(s.list) > 0 && !s.isop(-1) {
|
||||
switch k {
|
||||
case OPEN:
|
||||
if strings.HasSuffix(s.gets(-1), ice.PT) {
|
||||
if strings.HasSuffix(s.gets(-1), nfs.PT) {
|
||||
if s.peek(m) == TYPE {
|
||||
switch v := s.getv(m, -1).(type) {
|
||||
case Object:
|
||||
@ -338,10 +339,10 @@ func (s *Expr) cals(m *ice.Message, arg ...string) Any {
|
||||
return false
|
||||
}
|
||||
if !s.isop(k) {
|
||||
if strings.HasPrefix(k, ice.PT) {
|
||||
if strings.HasPrefix(k, nfs.PT) {
|
||||
if s.peek(m) == OPEN {
|
||||
s.skip++
|
||||
s.pops(1, s.call(m, s.getv(m, -1), strings.TrimPrefix(k, ice.PT)))
|
||||
s.pops(1, s.call(m, s.getv(m, -1), strings.TrimPrefix(k, nfs.PT)))
|
||||
return false
|
||||
} else if !s.isop(-1) && len(s.list) > 0 {
|
||||
s.pops(1, s.gets(-1)+k)
|
||||
|
@ -76,7 +76,7 @@ func (s *Stack) stack(cb func(*Frame, int) bool) {
|
||||
}
|
||||
}
|
||||
func (s *Stack) value(m *ice.Message, key string, arg ...Any) Any {
|
||||
keys := strings.Split(key, ice.PT)
|
||||
keys := strings.Split(key, nfs.PT)
|
||||
f, n := s.peekf(), len(s.frame)-1
|
||||
if len(arg) < 2 || arg[1] != DEFINE {
|
||||
s.stack(func(_f *Frame, i int) bool {
|
||||
@ -172,15 +172,15 @@ func (s *Stack) reads(m *ice.Message, cb func(k string) bool) {
|
||||
} else if len(block) > 0 {
|
||||
kit.If(s.line != last, func() { block, last = append(block, ice.NL), s.line })
|
||||
block = append(block, k)
|
||||
} else if k == "*" && v == ice.PS {
|
||||
} else if k == "*" && v == nfs.PS {
|
||||
comment = false
|
||||
s.skip++
|
||||
} else if comment {
|
||||
|
||||
} else if k == ice.PS && v == "*" {
|
||||
} else if k == nfs.PS && v == "*" {
|
||||
comment = true
|
||||
s.skip++
|
||||
} else if k == ice.PS && v == ice.PS {
|
||||
} else if k == nfs.PS && v == nfs.PS {
|
||||
s.comment = append(s.comment, s.list[s.line])
|
||||
s.skip = len(s.rest)
|
||||
} else if s.skip == 0 && strings.HasPrefix(k, "#") {
|
||||
@ -277,7 +277,7 @@ func (s *Stack) types(m *ice.Message) Any {
|
||||
}
|
||||
if s.line != line {
|
||||
kit.For(key, func(key string) {
|
||||
field := Field{types: key, name: kit.Select("", kit.Split(key, ice.PT), -1)}
|
||||
field := Field{types: key, name: kit.Select("", kit.Split(key, nfs.PT), -1)}
|
||||
m.Debug("value %s field %s %#v", Format(s), key, field)
|
||||
t.index[field.name] = key
|
||||
t.sups = append(t.sups, key)
|
||||
@ -293,7 +293,7 @@ func (s *Stack) types(m *ice.Message) Any {
|
||||
field := Field{types: types, name: key, tags: tags}
|
||||
kit.If(field.types == nil, func() {
|
||||
t.sups = append(t.sups, field.name)
|
||||
field.types, field.name = field.name, kit.Select("", kit.Split(field.name, ice.PT), -1)
|
||||
field.types, field.name = field.name, kit.Select("", kit.Split(field.name, nfs.PT), -1)
|
||||
})
|
||||
m.Debug("value %s field %s %#v", Format(s), key, field)
|
||||
t.index[field.name] = field
|
||||
@ -383,7 +383,7 @@ func (s *Stack) calls(m *ice.Message, obj Any, key string, cb func(*Frame, Funct
|
||||
obj, key = _v, ""
|
||||
}
|
||||
}
|
||||
kit.For(kit.Split(key, ice.PT), func(k string) {
|
||||
kit.For(kit.Split(key, nfs.PT), func(k string) {
|
||||
switch v := obj.(type) {
|
||||
case Operater:
|
||||
obj = v.Operate(SUBS, k)
|
||||
@ -392,7 +392,7 @@ func (s *Stack) calls(m *ice.Message, obj Any, key string, cb func(*Frame, Funct
|
||||
default:
|
||||
return
|
||||
}
|
||||
key = strings.TrimPrefix(strings.TrimPrefix(key, k), ice.PT)
|
||||
key = strings.TrimPrefix(strings.TrimPrefix(key, k), nfs.PT)
|
||||
})
|
||||
m.Debug("calls %s %T %s(%s)", Format(s), obj, key, Format(arg...))
|
||||
if obj == nil {
|
||||
@ -536,7 +536,7 @@ func _parse_link(m *ice.Message, p string) string {
|
||||
return ice.Render(m, ice.RENDER_ANCHOR, p, m.MergePodCmd("", "web.code.vimer", nfs.PATH, ls[0], nfs.FILE, ls[1], nfs.LINE, ls[2]))
|
||||
}
|
||||
func _parse_const(m *ice.Message, key string) string {
|
||||
if k := kit.Select(key, strings.Split(key, ice.PT), -1); kit.IsUpper(k) {
|
||||
if k := kit.Select(key, strings.Split(key, nfs.PT), -1); kit.IsUpper(k) {
|
||||
return strings.ToLower(k)
|
||||
}
|
||||
return ""
|
||||
@ -577,7 +577,7 @@ func init() {
|
||||
})
|
||||
loaded := kit.Dict()
|
||||
ice.AddMergeAction(func(c *ice.Context, key string, cmd *ice.Command, sub string, action *ice.Action) (init ice.Handler) {
|
||||
kit.IfNoKey(loaded, ice.SRC_SCRIPT+c.Prefix(key)+ice.PS, func(p string) { kit.If(nfs.Exists(ice.Pulse, p), func() { init = StackHandler }) })
|
||||
kit.IfNoKey(loaded, ice.SRC_SCRIPT+c.Prefix(key)+nfs.PS, func(p string) { kit.If(nfs.Exists(ice.Pulse, p), func() { init = StackHandler }) })
|
||||
return
|
||||
})
|
||||
}
|
||||
@ -586,7 +586,7 @@ func StackHandler(m *ice.Message, arg ...string) {
|
||||
script := []string{}
|
||||
m = m.Spawn(Index).Spawn(m.Target())
|
||||
s := NewStack(m, nil, m.PrefixKey())
|
||||
nfs.Open(m, ice.SRC_SCRIPT+m.PrefixKey()+ice.PS, func(r io.Reader, p string) {
|
||||
nfs.Open(m, ice.SRC_SCRIPT+m.PrefixKey()+nfs.PS, func(r io.Reader, p string) {
|
||||
kit.If(kit.Ext(p) == nfs.SHY, func() {
|
||||
if strings.HasPrefix(path.Base(p), "on") {
|
||||
script = append(script, kit.Format("Volcanos(\"%s\", {", kit.TrimExt(path.Base(p), nfs.SHY)))
|
||||
@ -606,7 +606,7 @@ func StackHandler(m *ice.Message, arg ...string) {
|
||||
})
|
||||
})
|
||||
if len(script) > 0 {
|
||||
p := ice.USR_SCRIPT + m.PrefixKey() + ice.PS + "list.js"
|
||||
p := ice.USR_SCRIPT + m.PrefixKey() + nfs.PS + "list.js"
|
||||
m.Cmd(nfs.SAVE, p, kit.Dict(nfs.CONTENT, strings.Join(script, ice.NL)))
|
||||
s.value(m, "_script", "/require/"+p)
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -243,14 +244,14 @@ func init() {
|
||||
case Message:
|
||||
m.EchoLine(" %s: %v", k, show(kit.FileLine(v.Call, 100)))
|
||||
case Function:
|
||||
m.EchoLine(" %s: %v", k, show(v.Position.name+ice.DF+kit.Format(v.Position.line+1)))
|
||||
m.EchoLine(" %s: %v", k, show(v.Position.name+nfs.DF+kit.Format(v.Position.line+1)))
|
||||
case Struct:
|
||||
m.EchoLine(" %s: %s", k, show(v.Position.name+ice.DF+kit.Format(v.Position.line+1)))
|
||||
m.EchoLine(" %s: %s", k, show(v.Position.name+nfs.DF+kit.Format(v.Position.line+1)))
|
||||
break
|
||||
kit.For(v.index, func(k string, v Any) {
|
||||
switch v := v.(type) {
|
||||
case Function:
|
||||
m.EchoLine(" %s: %v", k, show(v.Position.name+ice.DF+kit.Format(v.Position.line+1)))
|
||||
m.EchoLine(" %s: %v", k, show(v.Position.name+nfs.DF+kit.Format(v.Position.line+1)))
|
||||
case Field:
|
||||
m.EchoLine(" %s: %v", k, v.Format())
|
||||
}
|
||||
|
@ -293,10 +293,10 @@ func init() {
|
||||
kit.If(v.tags[mdb.DATA] != "", func() { kit.Value(config.Value, kit.Keym(v.name), v.tags[mdb.DATA]) })
|
||||
}
|
||||
})
|
||||
last, list := ice.Index, kit.Split(key, ice.PT)
|
||||
last, list := ice.Index, kit.Split(key, nfs.PT)
|
||||
for i := 1; i < len(list); i++ {
|
||||
has := false
|
||||
if ice.Pulse.Search(strings.Join(list[:i], ice.PT)+ice.PT, func(p *ice.Context, s *ice.Context) { has, last = true, s }); !has {
|
||||
if ice.Pulse.Search(strings.Join(list[:i], nfs.PT)+nfs.PT, func(p *ice.Context, s *ice.Context) { has, last = true, s }); !has {
|
||||
last = last.Register(&ice.Context{Name: list[i-1], Caches: ice.Caches{ice.CTX_FOLLOW: &ice.Cache{Value: kit.Keys(list[i-1])}}}, &web.Frame{})
|
||||
}
|
||||
if i == len(list)-1 {
|
||||
|
13
conf.go
13
conf.go
@ -81,8 +81,8 @@ const ( // DIR
|
||||
SH = "sh"
|
||||
GO = "go"
|
||||
JS = "js"
|
||||
CSS = "css"
|
||||
SVG = "svg"
|
||||
CSS = "css"
|
||||
HTML = "html"
|
||||
|
||||
LIB = "lib"
|
||||
@ -96,10 +96,13 @@ const ( // DIR
|
||||
FRAME_JS = "frame.js"
|
||||
INDEX_SH = "index.sh"
|
||||
|
||||
FAVICON_ICO = "/favicon.ico"
|
||||
PLUGIN_INPUT = "/plugin/input/"
|
||||
PLUGIN_LOCAL = "/plugin/local/"
|
||||
PLUGIN_STORY = "/plugin/story/"
|
||||
FAVICON_ICO = "/favicon.ico"
|
||||
PLUGIN_INPUT = "/plugin/input/"
|
||||
PLUGIN_LOCAL = "/plugin/local/"
|
||||
PLUGIN_STORY = "/plugin/story/"
|
||||
REQUIRE_SRC = "/require/src/"
|
||||
REQUIRE_USR = "/require/usr/"
|
||||
REQUIRE_MODULES = "/require/modules/"
|
||||
|
||||
ISH_PLUGED = ".ish/pluged/"
|
||||
USR_MODULES = "usr/node_modules/"
|
||||
|
@ -9,4 +9,4 @@ const CHAT = "chat"
|
||||
|
||||
var Index = &ice.Context{Name: CHAT, Help: "聊天中心"}
|
||||
|
||||
func init() { web.Index.Register(Index, &web.Frame{}) }
|
||||
func init() { web.Index.Register(Index, &web.Frame{}, FAVOR) }
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/gdb"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/ssh"
|
||||
@ -36,6 +37,9 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
FAVOR: {Name: "favor hash auto create getClipboardData getLocation scanQRCode record1 record2 upload demo", Help: "收藏夹", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == mdb.FOREACH && arg[1] == "" {
|
||||
m.PushSearch(mdb.TYPE, web.LINK, mdb.NAME, m.CommandKey(), mdb.TEXT, m.MergePodCmd("", "", log.DEBUG, ice.TRUE))
|
||||
}
|
||||
if arg[0] == mdb.FOREACH {
|
||||
m.Cmd("", ice.OptionFields("")).Table(func(value ice.Maps) {
|
||||
if arg[1] == "" || arg[1] == value[mdb.TYPE] || strings.Contains(value[mdb.TEXT], arg[1]) {
|
||||
|
@ -59,12 +59,12 @@ func _binpack_all(m *ice.Message) {
|
||||
list, cache := map[string]string{}, kit.Select(ice.USR_REQUIRE, m.Cmdx(cli.SYSTEM, GO, "env", "GOMODCACHE"))
|
||||
const _mod_ = "/pkg/mod/"
|
||||
for k := range ice.Info.File {
|
||||
switch ls := strings.Split(k, ice.PS); ls[2] {
|
||||
switch ls := kit.Split(k, ice.PS); ls[1] {
|
||||
case ice.SRC:
|
||||
case ice.USR:
|
||||
list[path.Join(kit.Slice(ls, 2, -1)...)] = ""
|
||||
list[path.Join(kit.Slice(ls, 1, -1)...)] = ""
|
||||
default:
|
||||
p := path.Join(cache, path.Join(kit.Slice(ls, 2, -1)...))
|
||||
p := path.Join(cache, path.Join(kit.Slice(ls, 1, -1)...))
|
||||
_ls := strings.Split(strings.Split(p, _mod_)[1], ice.PS)
|
||||
list[path.Join(nfs.USR, strings.Split(_ls[2], ice.AT)[0], path.Join(kit.Slice(_ls, 3)...))] = p
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ const INNER = "inner"
|
||||
func init() {
|
||||
var bind = []string{"usr/icebergs/core/", "usr/volcanos/plugin/local/"}
|
||||
Index.MergeCommands(ice.Commands{
|
||||
INNER: {Name: "inner path=src/@key file=main.go@key line=1 auto", Help: "源代码", Actions: ice.MergeActions(ice.Actions{
|
||||
INNER: {Name: "inner path=src/@key file=main.go@key line=1 auto exec", Help: "源代码", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch p := kit.Select(nfs.PWD, arg, 1); arg[0] {
|
||||
case ice.CMD:
|
||||
|
@ -11,7 +11,7 @@ const (
|
||||
const REPOS = nfs.REPOS
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{REPOS: {Name: "repos name auto", Actions: ice.Actions{
|
||||
Index.MergeCommands(ice.Commands{REPOS: {Name: "repos repos auto", Actions: ice.Actions{
|
||||
"status": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("web.code.git.status", arg) }},
|
||||
}, Hand: func(m *ice.Message, arg ...string) { m.Cmdy("web.code.git.repos", arg) }}})
|
||||
}
|
||||
|
@ -49,12 +49,10 @@ const VIMER = "vimer"
|
||||
|
||||
func init() {
|
||||
web.Index.MergeCommands(ice.Commands{
|
||||
web.PP(ice.REQUIRE, ice.SRC): {Name: "/require/src/", Help: "源代码", Actions: ice.MergeActions(ctx.CmdAction(), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
ice.REQUIRE_SRC: {Actions: ice.MergeActions(ctx.CmdAction(), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
web.ShareLocalFile(m, ice.SRC, path.Join(arg...))
|
||||
}},
|
||||
web.PP(ice.REQUIRE, ice.USR): {Name: "/require/usr/", Help: "代码库", Hand: func(m *ice.Message, arg ...string) {
|
||||
web.ShareLocalFile(m, ice.USR, path.Join(arg...))
|
||||
}},
|
||||
ice.REQUIRE_USR: {Hand: func(m *ice.Message, arg ...string) { web.ShareLocalFile(m, ice.USR, path.Join(arg...)) }},
|
||||
})
|
||||
Index.MergeCommands(ice.Commands{
|
||||
VIMER: {Name: "vimer path=src/@key file=main.go line=1 list", Help: "编辑器", Meta: kit.Dict(ctx.STYLE, INNER), Actions: ice.MergeActions(ice.Actions{
|
||||
|
2
exec.go
2
exec.go
@ -82,7 +82,7 @@ func (m *Message) Cmdv(arg ...Any) string {
|
||||
return m._command(kit.Slice(args, 0, -1), OptionFields(field)).Append(field)
|
||||
}
|
||||
func (m *Message) Cmdx(arg ...Any) string {
|
||||
res := kit.Select("", m._command(arg...).meta[MSG_RESULT], 0)
|
||||
res := strings.TrimSpace(kit.Select("", m._command(arg...).meta[MSG_RESULT], 0))
|
||||
return kit.Select("", res, res != ErrWarn)
|
||||
}
|
||||
func (m *Message) Cmdy(arg ...Any) *Message { return m.Copy(m._command(arg...)) }
|
||||
|
6
logs.go
6
logs.go
@ -94,9 +94,13 @@ func (m *Message) Warn(err Any, arg ...Any) bool {
|
||||
switch err := err.(type) {
|
||||
case error:
|
||||
if err == io.EOF {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
arg = append(arg, ERR, err)
|
||||
case string:
|
||||
if err != "" {
|
||||
return false
|
||||
}
|
||||
case bool:
|
||||
if !err {
|
||||
return false
|
||||
|
@ -8,14 +8,17 @@ import (
|
||||
"time"
|
||||
|
||||
git "shylinux.com/x/go-git/v5"
|
||||
"shylinux.com/x/go-git/v5/config"
|
||||
"shylinux.com/x/go-git/v5/plumbing"
|
||||
"shylinux.com/x/go-git/v5/plumbing/object"
|
||||
"shylinux.com/x/go-git/v5/plumbing/transport/http"
|
||||
"shylinux.com/x/go-git/v5/utils/diffmatchpatch"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
@ -72,8 +75,29 @@ func _repos_each(m *ice.Message, title string, cb func(*git.Repository, ice.Maps
|
||||
})
|
||||
|
||||
}
|
||||
func _repos_log(m *ice.Message, repos *git.Repository) error {
|
||||
iter, err := repos.Log(&git.LogOptions{})
|
||||
func _repos_branch(m *ice.Message, repos *git.Repository) error {
|
||||
iter, err := repos.Branches()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer m.StatusTimeCount()
|
||||
iter.ForEach(func(refer *plumbing.Reference) error {
|
||||
if commit, err := repos.CommitObject(refer.Hash()); err == nil {
|
||||
m.Push(mdb.TIME, commit.Author.When.Format(ice.MOD_TIME))
|
||||
m.Push(BRANCH, strings.TrimPrefix(refer.Name().String(), "refs/heads/"))
|
||||
m.Push(aaa.USERNAME, commit.Author.Name)
|
||||
m.Push(mdb.TEXT, commit.Message)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return nil
|
||||
}
|
||||
func _repos_log(m *ice.Message, branch *config.Branch, repos *git.Repository) error {
|
||||
refer, err := repos.Reference(branch.Merge, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
iter, err := repos.Log(&git.LogOptions{From: refer.Hash()})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -110,10 +134,13 @@ func _repos_stats(m *ice.Message, repos *git.Repository, h string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer m.StatusTimeCount()
|
||||
adds, dels := 0, 0
|
||||
for _, stat := range stats {
|
||||
m.Push(nfs.FILE, stat.Name).Push("add", stat.Addition).Push("del", stat.Deletion)
|
||||
adds += stat.Addition
|
||||
dels += stat.Deletion
|
||||
}
|
||||
m.StatusTimeCount("adds", adds, "dels", dels)
|
||||
return nil
|
||||
}
|
||||
func _repos_status(m *ice.Message, p string, repos *git.Repository) error {
|
||||
@ -171,15 +198,41 @@ func _repos_total(m *ice.Message, p string, repos *git.Repository, stats map[str
|
||||
}
|
||||
func _repos_vimer(m *ice.Message, _repos_path func(m *ice.Message, p string, arg ...string) string, arg ...string) {
|
||||
if len(arg) == 0 || arg[0] != ice.RUN {
|
||||
arg = []string{path.Join(arg[:2]...), kit.Select("README.md", arg, 2)}
|
||||
arg = []string{path.Join(arg[:3]...), kit.Select("README.md", arg, 3)}
|
||||
} else if kit.Select("", arg, 1) != ctx.ACTION {
|
||||
if ls := kit.Split(path.Join(m.Option(nfs.DIR_ROOT), arg[1]), nfs.PS); ls[1] == INDEX {
|
||||
if len(arg) < 3 {
|
||||
if ls := kit.Split(path.Join(m.Option(nfs.DIR_ROOT), arg[1]), nfs.PS); len(ls) < 2 || ls[2] == INDEX {
|
||||
if repos := _repos_open(m, ls[0]); len(arg) < 3 {
|
||||
if work, err := repos.Worktree(); err == nil {
|
||||
if status, err := work.Status(); err == nil {
|
||||
for k := range status {
|
||||
m.Echo(k)
|
||||
}
|
||||
}
|
||||
}
|
||||
m.Cmdy(nfs.DIR, nfs.PWD, kit.Dict(nfs.DIR_ROOT, _repos_path(m, ls[0])))
|
||||
} else {
|
||||
m.Cmdy(nfs.CAT, _repos_path(m, ls[0], arg[2]))
|
||||
if refer, err := repos.Head(); err == nil {
|
||||
if commit, err := repos.CommitObject(refer.Hash()); err == nil {
|
||||
if file, err := commit.File(arg[2]); !m.Warn(err) {
|
||||
if content, err := file.Contents(); !m.Warn(err) {
|
||||
for _, diff := range diffmatchpatch.New().DiffMain(content, m.Result(), true) {
|
||||
switch diff.Type {
|
||||
case diffmatchpatch.DiffDelete:
|
||||
m.Push(mdb.TYPE, mdb.DELETE)
|
||||
case diffmatchpatch.DiffInsert:
|
||||
m.Push(mdb.TYPE, mdb.INSERT)
|
||||
default:
|
||||
m.Push(mdb.TYPE, "")
|
||||
}
|
||||
m.Push(mdb.TEXT, diff.Text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if commit, err := _repos_open(m, ls[0]).CommitObject(plumbing.NewHash(ls[1])); m.Warn(err) {
|
||||
} else if commit, err := _repos_open(m, ls[0]).CommitObject(plumbing.NewHash(ls[2])); m.Warn(err) {
|
||||
return
|
||||
} else if len(arg) < 3 {
|
||||
if iter, err := commit.Files(); !m.Warn(err) {
|
||||
@ -188,9 +241,31 @@ func _repos_vimer(m *ice.Message, _repos_path func(m *ice.Message, p string, arg
|
||||
return nil
|
||||
})
|
||||
}
|
||||
if stats, err := commit.Stats(); err == nil {
|
||||
for _, stat := range stats {
|
||||
m.Echo(stat.Name)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if file, err := commit.File(arg[2]); !m.Warn(err) {
|
||||
if content, err := file.Contents(); !m.Warn(err) {
|
||||
if parent, err := commit.Parent(0); err == nil {
|
||||
if file0, err := parent.File(arg[2]); err == nil {
|
||||
if content0, err := file0.Contents(); err == nil {
|
||||
for _, diff := range diffmatchpatch.New().DiffMain(content0, content, true) {
|
||||
switch diff.Type {
|
||||
case diffmatchpatch.DiffDelete:
|
||||
m.Push(mdb.TYPE, mdb.DELETE)
|
||||
case diffmatchpatch.DiffInsert:
|
||||
m.Push(mdb.TYPE, mdb.INSERT)
|
||||
default:
|
||||
m.Push(mdb.TYPE, "")
|
||||
}
|
||||
m.Push(mdb.TEXT, diff.Text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m.Echo(content)
|
||||
}
|
||||
}
|
||||
@ -211,8 +286,9 @@ const (
|
||||
STASH = "stash"
|
||||
COMMIT = "commit"
|
||||
|
||||
ORIGIN = "origin"
|
||||
BRANCH = "branch"
|
||||
|
||||
ORIGIN = "origin"
|
||||
MASTER = "master"
|
||||
INDEX = "index"
|
||||
)
|
||||
@ -240,11 +316,16 @@ func init() {
|
||||
}},
|
||||
})
|
||||
Index.MergeCommands(ice.Commands{
|
||||
REPOS: {Name: "repos repos commit:text file:text auto", Help: "仓库", Actions: ice.MergeActions(ice.Actions{
|
||||
REPOS: {Name: "repos repos branch:text commit:text file:text auto", Help: "代码库", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(nfs.DIR, nfs.USR, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) })
|
||||
_repos_insert(m, kit.Path(""))
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == mdb.FOREACH && arg[1] == "" {
|
||||
m.PushSearch(mdb.TYPE, web.LINK, mdb.NAME, m.CommandKey(), mdb.TEXT, m.MergePodCmd("", "", log.DEBUG, ice.TRUE))
|
||||
}
|
||||
}},
|
||||
CLONE: {Name: "clone origin* branch name path", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.OptionDefault(mdb.NAME, path.Base(m.Option(ORIGIN)))
|
||||
m.OptionDefault(nfs.PATH, path.Join(path.Join(nfs.USR, m.Option(mdb.NAME))))
|
||||
@ -282,7 +363,10 @@ func init() {
|
||||
})
|
||||
}},
|
||||
LOG: {Hand: func(m *ice.Message, arg ...string) {
|
||||
_repos_log(m, _repos_open(m, kit.Select(m.Option(REPOS), arg, 0)))
|
||||
repos := _repos_open(m, kit.Select(m.Option(REPOS), arg, 0))
|
||||
if branch, err := repos.Branch(kit.Select(m.Option(BRANCH), arg, 1)); !m.Warn(err) {
|
||||
_repos_log(m, branch, repos)
|
||||
}
|
||||
}},
|
||||
TAG: {Name: "tag version", Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(m.Option(VERSION) == "", func() { m.Option(VERSION, _status_tag(m, m.Option(TAGS))) })
|
||||
@ -301,7 +385,7 @@ func init() {
|
||||
STASH: {Hand: func(m *ice.Message, arg ...string) { _repos_cmd(m, kit.Select(m.Option(REPOS), arg, 0), STASH) }},
|
||||
COMMIT: {Name: "commit actions=add,opt,fix comment*=some", Hand: func(m *ice.Message, arg ...string) {
|
||||
if work, err := _repos_open(m, m.Option(REPOS)).Worktree(); !m.Warn(err) {
|
||||
_, err := work.Commit(m.Option("actions")+ice.SP+m.Option("comment"), &git.CommitOptions{})
|
||||
_, err := work.Commit(m.Option("actions")+ice.SP+m.Option("comment"), &git.CommitOptions{All: true})
|
||||
m.Warn(err)
|
||||
}
|
||||
}},
|
||||
@ -340,13 +424,15 @@ func init() {
|
||||
m.StatusTimeCount()
|
||||
}},
|
||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Assert(m.Option(REPOS) != "" && m.Option(nfs.FILE) != "")
|
||||
nfs.Trash(m, _repos_path(m, m.Option(REPOS), m.Option(nfs.FILE)))
|
||||
if !m.Warn(m.Option(REPOS), ice.ErrNotValid, REPOS) && !m.Warn(m.Option(nfs.FILE), ice.ErrNotValid, nfs.FILE) {
|
||||
nfs.Trash(m, _repos_path(m, m.Option(REPOS), m.Option(nfs.FILE)))
|
||||
}
|
||||
}},
|
||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Assert(m.Option(REPOS) != "")
|
||||
mdb.HashRemove(m, m.Option(REPOS))
|
||||
nfs.Trash(m, _repos_path(m, m.Option(REPOS)))
|
||||
if !m.Warn(m.Option(REPOS), ice.ErrNotValid, REPOS) {
|
||||
nfs.Trash(m, _repos_path(m, m.Option(REPOS)))
|
||||
mdb.HashRemove(m, m.Option(REPOS))
|
||||
}
|
||||
}},
|
||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(m.Option(REPOS), func(p string) {
|
||||
@ -356,15 +442,19 @@ func init() {
|
||||
code.VIMER: {Hand: func(m *ice.Message, arg ...string) { _repos_vimer(m, _repos_path, arg...) }},
|
||||
}, mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,commit,origin"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
mdb.HashSelect(m, arg...).Sort(REPOS).Action(CLONE, PULL, PUSH, STATUS, TOTAL)
|
||||
mdb.HashSelect(m, arg...).Sort(REPOS).Action(CLONE, PULL, PUSH)
|
||||
} else if len(arg) == 1 {
|
||||
_repos_log(m, _repos_open(m, arg[0]))
|
||||
m.Action(TOTAL)
|
||||
_repos_branch(m, _repos_open(m, arg[0]))
|
||||
} else if len(arg) == 2 {
|
||||
if repos := _repos_open(m, arg[0]); arg[1] == INDEX {
|
||||
repos := _repos_open(m, arg[0])
|
||||
if branch, err := repos.Branch(arg[1]); !m.Warn(err) {
|
||||
_repos_log(m, branch, repos)
|
||||
}
|
||||
} else if len(arg) == 3 {
|
||||
if repos := _repos_open(m, arg[0]); arg[2] == INDEX {
|
||||
_repos_status(m, arg[0], repos)
|
||||
} else {
|
||||
_repos_stats(m, repos, arg[1])
|
||||
_repos_stats(m, repos, arg[2])
|
||||
}
|
||||
} else {
|
||||
m.Cmdy("", code.VIMER, arg)
|
||||
|
@ -145,7 +145,10 @@ func init() {
|
||||
m.Echo(strings.ReplaceAll(m.Cmdx("web.code.publish", ice.CONTEXTS), "app username", "dev username"))
|
||||
m.Echo(m.Cmdx(TOKEN, m.Option(ice.MSG_USERNAME)))
|
||||
} else if len(arg) == 1 {
|
||||
_repos_log(m, _repos_open(m, arg[0]))
|
||||
repos := _repos_open(m, arg[0])
|
||||
if branch, err := repos.Branch(arg[1]); !m.Warn(err) {
|
||||
_repos_log(m, branch, repos)
|
||||
}
|
||||
} else if len(arg) == 2 {
|
||||
if repos := _repos_open(m, arg[0]); arg[1] == INDEX {
|
||||
_repos_status(m, arg[0], repos)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
@ -45,12 +45,14 @@ func _status_stat(m *ice.Message, files, adds, dels int) (int, int, int) {
|
||||
})
|
||||
return files, adds, dels
|
||||
}
|
||||
func _status_list(m *ice.Message) (files, adds, dels int, last time.Time) {
|
||||
func _status_list(m *ice.Message) (files, adds, dels int, last string) {
|
||||
onlychange := m.Option(ice.MSG_MODE) == mdb.ZONE
|
||||
defer m.Option(cli.CMD_DIR, "")
|
||||
ReposList(m).Table(func(value ice.Maps) {
|
||||
m.Option(cli.CMD_DIR, value[nfs.PATH])
|
||||
files, adds, dels = _status_stat(m, files, adds, dels)
|
||||
_last := m.Cmdv(REPOS, path.Base(value[nfs.PATH]), mdb.TIME)
|
||||
kit.If(_last > last, func() { last = _last })
|
||||
tags := _git_tags(m)
|
||||
kit.SplitKV(ice.SP, ice.NL, _git_status(m), func(text string, ls []string) {
|
||||
switch kit.Ext(ls[1]) {
|
||||
@ -153,7 +155,7 @@ func init() {
|
||||
text = append(text, list[0]+" file")
|
||||
} else if strings.Contains(line, "ins") {
|
||||
text = append(text, list[0]+" +++")
|
||||
} else if strings.Contains(line, "dele") {
|
||||
} else if strings.Contains(line, "del") {
|
||||
text = append(text, list[0]+" ---")
|
||||
}
|
||||
}
|
||||
@ -168,7 +170,7 @@ func init() {
|
||||
m.Echo("please config user.email").Action(CONFIGS)
|
||||
} else if len(arg) == 0 {
|
||||
files, adds, dels, last := _status_list(m)
|
||||
m.StatusTimeCount("files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME), nfs.ORIGIN, _git_remote(m))
|
||||
m.StatusTimeCount("files", files, "adds", adds, "dels", dels, "last", last, nfs.ORIGIN, _git_remote(m))
|
||||
m.Action(PULL, PUSH, "insteadof", "oauth").Sort("repos,type,file")
|
||||
} else {
|
||||
_repos_cmd(m, arg[0], DIFF)
|
||||
|
@ -103,8 +103,7 @@ func init() {
|
||||
dels += kit.Int(del)
|
||||
return
|
||||
}
|
||||
m.Push(FROM, ls[0]).Push(COMMIT, ls[1])
|
||||
m.Push(ADDS, add).Push(DELS, del).Push(REST, kit.Int(add)-kit.Int(del))
|
||||
m.Push(FROM, ls[0]).Push(ADDS, add).Push(DELS, del).Push(REST, kit.Int(add)-kit.Int(del)).Push(COMMIT, ls[1])
|
||||
})
|
||||
if total {
|
||||
m.Push(TAGS, _git_cmds(m, "describe", "--tags"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user