diff options
Diffstat (limited to 'human.go')
| -rw-r--r-- | human.go | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/human.go b/human.go deleted file mode 100644 index fab41d1..0000000 --- a/human.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 - -package forgepb - -// OLD STUFF. REMOVE. USE PROTOBUF TABLES - -// mostly just functions related to making STDOUT -// more readable by us humans - -// also function shortcuts the do fixed limited formatting (it's like COBOL) -// so reporting tables of the status of what droplets and hypervisors -// are in text columns and rows that can be easily read in a terminal - -/* -func standardHeader() string { - return fmt.Sprintf("%-4s %-40s %s", "", "Path", "flags") -} - -func (f *Forge) standardHeader(r *ForgeConfig) string { - var flags string - var readonly string - if f.Config.IsPrivate(r.GoPath) { - flags += "(private) " - } - if f.Config.IsFavorite(r.GoPath) { - flags += "(favorite) " - } - if f.Config.IsReadOnly(r.GoPath) { - readonly = "" - } else { - readonly = "r/w" - } - if r.MasterBranchName != "" { - flags += "(master=" + r.MasterBranchName + ") " - } - if r.DevelBranchName != "" { - flags += "(devel=" + r.DevelBranchName + ") " - } - if r.UserBranchName != "" { - flags += "(user=" + r.UserBranchName + ") " - } - if r.DebName != "" { - flags += "(deb=" + r.DebName + ") " - } - return fmt.Sprintf("%-4s %-40s %s", readonly, r.GoPath, flags) -} - -// print a human readable table to STDOUT -func (f *Forge) ConfigPrintTable() { - if f == nil { - return - } - log.Info(standardHeader()) - all := f.Config.All() - for all.Scan() { - r := all.Next() - log.Info(f.standardHeader(r)) - } -} - -// show information while doing golang releases -func (f *Forge) StandardReleaseHeader(repo *gitpb.Repo, state string) string { - // tag := repo.NewestTag() - // gitAge, _ := tag.GetDate() - dur := repo.NewestAge() - - curname := repo.GetCurrentBranchName() - - lastTag := repo.GetLastTag() - target := repo.GetTargetVersion() - master := repo.GetMasterVersion() - user := repo.GetUserVersion() - - header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-20s %-20s %-15s", - repo.GetGoPath(), shell.FormatDuration(dur), curname, - lastTag, target, master, user, - state) - return header -} - -func ReleaseReportHeader() string { - return fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-20s %-20s %-15s", - "REPO", "AGE", "CUR BR", - "LAST", "TARGET", - "MASTER", "USER", - "STATE") -} - -func (f *Forge) PrintReleaseReport(repos *gitpb.Repos) int { - var count int - - log.Info(ReleaseReportHeader()) - - loop := repos.SortByFullPath() - for loop.Scan() { - check := loop.Next() - count += 1 - if check == nil { - // wtf - continue - } - var state string - if check.CheckDirty() { - state = "(dirty)" - } - log.Info(f.StandardReleaseHeader(check, state)) - } - log.Info(fmt.Sprintf("total repo count = %d", count)) - return count -} -*/ |
