summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go73
1 files changed, 4 insertions, 69 deletions
diff --git a/main.go b/main.go
index 1a2db21..a5da179 100644
--- a/main.go
+++ b/main.go
@@ -5,7 +5,6 @@ import (
"fmt"
"net/http"
"strings"
- "time"
"go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/forgepb"
@@ -35,7 +34,7 @@ var LIBDIR string = "/var/lib/gowebd/"
func main() {
me = new(mainType)
- me.sh = prep.Bash(&argv) // adds shell auto complete to go-args
+ me.sh = prep.Autocomplete(&argv) // adds shell auto complete to go-args
if argv.RepoMap != "" {
REPOMAP = argv.RepoMap
@@ -47,7 +46,7 @@ func main() {
gitMap = make(map[string]*gitpb.Repo)
repoMap = make(map[string]string)
- me.forge = forgepb.Init()
+ me.forge, _ = forgepb.Init()
// parse the repomap file
readRepomap()
@@ -102,71 +101,7 @@ func newMakeRepomap() (string, error) {
log.Info(repo.Namespace, repo.URL)
}
- makePullTable(updatepb)
+ footer := updatepb.PrintGowebdTable()
+ log.Info(footer)
return "new dynamic repomap!", nil
}
-
-func makePullTable(pb *gitpb.Repos) {
- t := pb.NewTable("pullTable")
- t.NewUuid()
-
- var col *gitpb.RepoFunc
- // var col int
-
- col = t.AddNamespace()
- col.Width = 30
-
- col = t.AddMasterVersion()
- // col.SetTitle("mver")
- col.Width = 15
-
- col = t.AddStringFunc("Tags", func(r *gitpb.Repo) string {
- if r.Tags == nil {
- return "nil"
- }
- log.Infof("repo: %v\n", r)
- return log.Sprintf("len(%d)", r.Tags.Len())
- })
- col.Width = 9
-
- col = t.AddStringFunc("cur tag", func(r *gitpb.Repo) string {
- if r.CurrentTag == nil {
- return "nil"
- }
- return "ok"
- })
- col.Width = 9
-
- col = t.AddDevelVersion()
- col.Width = 15
-
- col = t.AddFullPath()
- col.Width = -1
-
- t.PrintTable()
-}
-
-func formatDuration(d time.Duration) string {
- seconds := int(d.Seconds()) % 60
- minutes := int(d.Minutes()) % 60
- hours := int(d.Hours()) % 24
- days := int(d.Hours()) / 24
-
- result := ""
- if days > 0 {
- result += fmt.Sprintf("%dd ", days)
- return result
- }
- if hours > 0 {
- result += fmt.Sprintf("%dh ", hours)
- return result
- }
- if minutes > 0 {
- result += fmt.Sprintf("%dm ", minutes)
- return result
- }
- if seconds > 0 {
- result += fmt.Sprintf("%ds", seconds)
- }
- return result
-}