2024-02-11 06:32:48 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
2024-02-12 15:23:44 -06:00
|
|
|
"time"
|
2024-02-11 06:32:48 -06:00
|
|
|
|
|
|
|
"go.wit.com/lib/gadgets"
|
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
func RemoveFirstElement(slice []string) (string, []string) {
|
|
|
|
if len(slice) == 0 {
|
|
|
|
return "", slice // Return the original slice if it's empty
|
|
|
|
}
|
|
|
|
return slice[0], slice[1:] // Return the slice without the first element
|
|
|
|
}
|
|
|
|
|
|
|
|
// homeDir, _ := os.UserHomeDir()
|
|
|
|
|
|
|
|
func (c *controlBox) addRepo(path string) {
|
|
|
|
path = strings.Trim(path, "/") // trim any extranous '/' chars put in the config file by the user
|
|
|
|
if path == "" {
|
|
|
|
log.Warn("addRepo() got empty path", path)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-02-20 23:13:26 -06:00
|
|
|
// if repostatus.VerifyLocalGoRepo(path) {
|
|
|
|
// log.Verbose("path actually exists", path)
|
|
|
|
// } else {
|
|
|
|
// log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path)
|
|
|
|
// return
|
|
|
|
// }
|
2024-02-11 06:32:48 -06:00
|
|
|
|
|
|
|
c.pathL = gadgets.NewOneLiner(c.grid, "path")
|
|
|
|
c.pathL.SetText(path)
|
|
|
|
c.grid.NextRow()
|
|
|
|
|
|
|
|
c.lastTag = gadgets.NewOneLiner(c.grid, "lastTag")
|
|
|
|
c.grid.NextRow()
|
|
|
|
|
|
|
|
c.dirtyL = gadgets.NewOneLiner(c.grid, "dirty")
|
|
|
|
c.grid.NextRow()
|
|
|
|
|
|
|
|
c.currentL = gadgets.NewOneLiner(c.grid, "current")
|
|
|
|
c.grid.NextRow()
|
|
|
|
|
2024-02-12 15:23:44 -06:00
|
|
|
c.buildDate = gadgets.NewOneLiner(c.grid, "Build Date")
|
|
|
|
c.grid.NextRow()
|
|
|
|
|
|
|
|
stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC")
|
|
|
|
c.buildDate.SetText(stamp)
|
|
|
|
|
2024-11-19 05:30:56 -06:00
|
|
|
c.tagDate = gadgets.NewBasicEntry(c.grid, "git tag Date")
|
2024-02-12 15:23:44 -06:00
|
|
|
c.grid.NextRow()
|
|
|
|
|
2024-12-01 00:48:07 -06:00
|
|
|
cbname := repo.GetCurrentBranchName()
|
|
|
|
cbversion := repo.GetCurrentBranchVersion()
|
|
|
|
debversion := repo.DebianCurrentVersion()
|
2024-02-11 06:32:48 -06:00
|
|
|
|
2024-12-01 00:48:07 -06:00
|
|
|
if repo.CheckDirty() {
|
2024-02-11 06:32:48 -06:00
|
|
|
c.dirtyL.SetText("true")
|
|
|
|
} else {
|
|
|
|
c.dirtyL.SetText("false")
|
|
|
|
}
|
|
|
|
|
2024-11-21 00:14:12 -06:00
|
|
|
if c.GoPath.String() == "" {
|
2024-12-01 00:48:07 -06:00
|
|
|
c.GoPath.SetText(repo.GoPath)
|
2024-11-21 00:14:12 -06:00
|
|
|
}
|
|
|
|
|
2024-12-01 00:48:07 -06:00
|
|
|
lasttag := repo.GetLastTagVersion()
|
2024-11-06 13:46:15 -06:00
|
|
|
if argv.Release {
|
2024-12-01 00:48:07 -06:00
|
|
|
debversion = repo.DebianReleaseVersion()
|
2024-02-20 23:13:26 -06:00
|
|
|
c.dirtyL.SetText("false")
|
|
|
|
}
|
|
|
|
|
2024-02-11 06:32:48 -06:00
|
|
|
c.Version.SetText(debversion)
|
|
|
|
|
|
|
|
c.lastTag.SetText(lasttag)
|
|
|
|
c.currentL.SetText(cbname + " " + cbversion)
|
|
|
|
|
2024-02-12 15:23:44 -06:00
|
|
|
tagDate := c.getDateStamp(lasttag)
|
|
|
|
c.tagDate.SetText(tagDate)
|
|
|
|
|
2024-02-11 06:32:48 -06:00
|
|
|
return
|
|
|
|
}
|