diff --git a/misc/git/spide.go b/misc/git/spide.go index 19c4435b..a2c74ecf 100644 --- a/misc/git/spide.go +++ b/misc/git/spide.go @@ -1,7 +1,6 @@ package git import ( - "os" "path" "strings" @@ -25,6 +24,11 @@ func _spide_for(text string, cb func([]string)) { func _spide_go(m *ice.Message, file string) { _spide_for(m.Cmdx(cli.SYSTEM, "gotags", file), func(ls []string) { switch ls[3] { + case "i": + return + case "w", "e": + return + ls[0] = "-" + ls[0] + ":" + strings.TrimPrefix(ls[len(ls)-1], "type:") case "m": if strings.HasPrefix(ls[5], "ctype") { ls[0] = strings.TrimPrefix(ls[5], "ctype:") + ":" + ls[0] @@ -33,8 +37,6 @@ func _spide_go(m *ice.Message, file string) { } else { ls[0] = ls[3] + ":" + ls[0] } - case "w": - ls[0] = "-" + ls[0] + ":" + strings.TrimPrefix(ls[len(ls)-1], "type:") default: ls[0] = ls[3] + ":" + ls[0] } @@ -69,7 +71,7 @@ func init() { return } - if wd, _ := os.Getwd(); arg[0] == path.Base(wd) { + if arg[0] == path.Base(kit.Pwd()) { m.Option(nfs.DIR_ROOT, path.Join(kit.SSH_SRC)) } else { m.Option(nfs.DIR_ROOT, path.Join(kit.SSH_USR, arg[0])) @@ -78,6 +80,7 @@ func init() { if len(arg) == 1 { // 目录列表 m.Option(nfs.DIR_DEEP, "true") nfs.Dir(m, kit.MDB_PATH) + color := []string{"yellow", "blue", "cyan", "red"} m.Table(func(index int, value map[string]string, head []string) { m.Push(kit.MDB_COLOR, color[strings.Count(value[kit.MDB_PATH], "/")%len(color)]) diff --git a/misc/git/status.go b/misc/git/status.go index efe6d71b..91449402 100644 --- a/misc/git/status.go +++ b/misc/git/status.go @@ -2,6 +2,7 @@ package git import ( "strings" + "time" ice "github.com/shylinux/icebergs" "github.com/shylinux/icebergs/base/cli" @@ -49,7 +50,7 @@ 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) { +func _status_list(m *ice.Message) (files, adds, dels int, last time.Time) { m.Cmd(REPOS, ice.OptionFields("name,path")).Table(func(index int, value map[string]string, head []string) { m.Option(cli.CMD_DIR, value[kit.MDB_PATH]) diff := m.Cmdx(cli.SYSTEM, GIT, STATUS, "-sb") @@ -77,6 +78,10 @@ func _status_list(m *ice.Message) (files, adds, dels int) { } files, adds, dels = _status_stat(m, files, adds, dels) + now, _ := time.Parse("2006-01-02 15:04:05 -0700", strings.TrimSpace(m.Cmdx(cli.SYSTEM, GIT, "log", `--pretty=%cd`, "--date=iso", "-n1"))) + if now.After(last) { + last = now + } }) return } @@ -135,8 +140,8 @@ func init() { if len(arg) == 0 { m.Action(PULL, MAKE, PUSH) - files, adds, dels := _status_list(m) - m.Status("files", files, "adds", adds, "dels", dels) + files, adds, dels, last := _status_list(m) + m.Status("files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME)) m.Toast(kit.Format("files: %d, adds: %d, dels: %d", files, adds, dels), ice.CONTEXTS, "3s") return }