diff --git a/tagWindow.go b/tagWindow.go index 07effd3..fed6f1a 100644 --- a/tagWindow.go +++ b/tagWindow.go @@ -9,6 +9,7 @@ import ( "time" "go.wit.com/gui" + "go.wit.com/lib/gui/shell" "go.wit.com/log" ) @@ -97,7 +98,7 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) error { rTag.ref = grid.NewEntrybox(tag.GetHash()) ctime := tag.GetAuthordate().AsTime() - dur := getDurationStamp(ctime) + dur := shell.GetDurationStamp(ctime) rTag.date = grid.NewLabel(ctime.Format("YYYY/MM/DD")) rTag.duration = grid.NewLabel(dur) diff --git a/unix.go b/unix.go index ffe1610..69cc02d 100644 --- a/unix.go +++ b/unix.go @@ -1,7 +1,6 @@ package repostatus import ( - "fmt" "os" "os/exec" "path/filepath" @@ -13,65 +12,6 @@ import ( "go.wit.com/log" ) -/* -// goes in one directory so it gets remote branch names -func listFiles(directory string) []string { - var files []string - fileInfo, err := os.ReadDir(directory) - if err != nil { - log.Error(err) - return nil - } - - for _, file := range fileInfo { - if file.IsDir() { - dirname := file.Name() - newdir, _ := os.ReadDir(directory + "/" + dirname) - for _, file := range newdir { - if !file.IsDir() { - files = append(files, dirname+"/"+file.Name()) - } - } - } else { - files = append(files, file.Name()) - } - } - - return files -} -*/ - -/* -func normalizeVersion(s string) string { - // reg, err := regexp.Compile("[^a-zA-Z0-9]+") - parts := strings.Split(s, "-") - if len(parts) == 0 { - return "" - } - reg, err := regexp.Compile("[^0-9.]+") - if err != nil { - log.Log(WARN, "normalizeVersion() regexp.Compile() ERROR =", err) - return parts[0] - } - clean := reg.ReplaceAllString(parts[0], "") - log.Log(INFO, "normalizeVersion() s =", clean) - return clean -} - -func splitVersion(version string) (a, b, c string) { - tmp := normalizeVersion(version) - parts := strings.Split(tmp, ".") - switch len(parts) { - case 1: - return parts[0], "", "" - case 2: - return parts[0], parts[1], "" - default: - return parts[0], parts[1], parts[2] - } -} -*/ - func (rs *RepoStatus) Run(cmd []string) cmd.Status { path := rs.realPath.String() r := shell.PathRun(path, cmd) @@ -134,6 +74,7 @@ func Exists(file string) bool { return true } +/* func getDurationStamp(t time.Time) string { // Get the current time @@ -174,6 +115,7 @@ func formatDuration(d time.Duration) string { } return result } +*/ func (rs *RepoStatus) XtermNohup(cmdline string) { shell.XtermCmd(rs.Path(), []string{cmdline})