summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--argv.go1
-rw-r--r--cobol.go23
-rw-r--r--main.go21
4 files changed, 47 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 00e8f76..35f24d7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,14 @@
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d)
-all:
+info:
make private
@echo "make restart # remove the repos.pb file"
@echo "make private # only the private ones"
@echo "make mine # just show my repos"
+ @echo "make all # show all repos"
@echo "make pull # run git pull on every repo"
+ @echo "make dirty # CheckDirty()"
vet:
@GO111MODULE=off go vet
@@ -62,6 +64,9 @@ pull: install
mine: install
forge --find-mine
+all: install
+ forge --find-all
+
gui: install
forge --do-gui
@@ -74,6 +79,9 @@ patches-localhost: install
patches-list: install
forge --list-patches --url "http://localhost:2233/"
+dirty: install
+ forge --dirty
+
restart:
reset
-rm ~/go/src/repos.pb
diff --git a/argv.go b/argv.go
index 66a7393..3c7c2ba 100644
--- a/argv.go
+++ b/argv.go
@@ -29,6 +29,7 @@ type args struct {
Fix bool `arg:"--fix" help:"fix config, save config & exit"`
URL string `arg:"--url" default:"http://go.wit.com/" help:"base url"`
Delete string `arg:"--delete" help:"delete this repo"`
+ Dirty bool `arg:"--dirty" help:"git CheckDirty() on every repo"`
}
func (args) Version() string {
diff --git a/cobol.go b/cobol.go
index 793075e..f2bcfaa 100644
--- a/cobol.go
+++ b/cobol.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
+ "go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -33,7 +34,7 @@ func doCobol() {
log.DaemonMode(true)
// log.Info(standardStart5("gopath", "cur name", "master", "user", "repo type"))
- log.Info(standardStart8("gopath", "cur name", "target", "master", "devel", "user", "curver", "repo type"))
+ log.Info(standardStart8("gopath", "cur name", "age", "target", "master", "devel", "user", "curver", "repo type"))
all := me.found.SortByFullPath()
for all.Scan() {
repo := all.Next()
@@ -71,15 +72,16 @@ func standardStart5(arg1, arg2, arg3, arg4, arg5 string) string {
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5)
}
-func standardStart8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 string) string {
+func standardStart8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 string) string {
len1 := 40
len2 := 12
- len3 := 16
+ len3 := 6
len4 := 16
len5 := 16
len6 := 16
len7 := 16
- len8 := 8
+ len8 := 16
+ len9 := 8
var s string
if len(arg1) > len1 {
arg1 = arg1[:len1]
@@ -118,12 +120,17 @@ func standardStart8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 string) strin
}
s += "%-" + fmt.Sprintf("%d", len8) + "s"
- return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
+ if len(arg9) > len9 {
+ arg9 = arg9[:len9]
+ }
+ s += "%-" + fmt.Sprintf("%d", len9) + "s"
+
+ return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
}
func verifyPrint(repo *gitpb.Repo) {
var end string
- if repo.CheckDirty() {
+ if repo.IsDirty() {
end += "(dirty) "
}
s := make(map[string]string)
@@ -144,8 +151,10 @@ func verifyPrint(repo *gitpb.Repo) {
var chort string = s["cver"] // current version
var cname string = s["cname"] // current branch name git is on now
+ age := shell.FormatDuration(repo.NewestAge())
+
// start := fmt.Sprintf("%-40s %-12s %-12s %-12s %-8s", s["gopath"], cname, mhort, uhort, s["rtype"])
- start := standardStart8(s["gopath"], cname, thort, mhort, dhort, uhort, chort, s["rtype"])
+ start := standardStart8(s["gopath"], cname, age, thort, mhort, dhort, uhort, chort, s["rtype"])
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
end += "(readonly) "
diff --git a/main.go b/main.go
index 92704e0..562565d 100644
--- a/main.go
+++ b/main.go
@@ -48,6 +48,27 @@ func main() {
okExit("")
}
+ if argv.Dirty {
+ all := me.forge.Repos.SortByFullPath()
+ for all.Scan() {
+ repo := all.Next()
+ dirty := repo.IsDirty()
+ if repo.CheckDirty() {
+ me.found.AppendUniqueGoPath(repo)
+ if !dirty {
+ configSave = true
+ }
+ } else {
+ if dirty {
+ configSave = true
+ }
+ }
+ }
+ doCobol()
+ me.forge.SetConfigSave(configSave)
+ okExit("")
+ }
+
/*
// var count int
all := me.forge.Repos.SortByFullPath()