summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-03 17:59:47 -0600
committerJeff Carr <[email protected]>2024-12-03 17:59:47 -0600
commit923160d70cd4f21896d6c57a39bdcce3e1ae0af6 (patch)
treeef0ab18cfd34c42b616461fc9f86ecf1a4d46b9a
parentd1cc3bd09a78bc83f8fa50af267c15bebac880df (diff)
forge --private : your configured private reposv0.22.8v0.22.7v0.22.6
-rw-r--r--Makefile4
-rw-r--r--argv.go1
-rw-r--r--list.go46
3 files changed, 48 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 484f025..a8a7de7 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,10 @@ list: build
reset
./forge --list
+list-private: build
+ reset
+ ./forge --list --private
+
list-fix: build
reset
./forge --list --fix
diff --git a/argv.go b/argv.go
index 0237182..620f591 100644
--- a/argv.go
+++ b/argv.go
@@ -23,6 +23,7 @@ type args struct {
Clone bool `arg:"--clone" help:"go-clone things you are missing"`
Force bool `arg:"--force" help:"force redo go-clone"`
Erase bool `arg:"--erase" help:"erase"`
+ Private bool `arg:"--private" help:"list private repos in .config/forge/"`
}
func (args) Version() string {
diff --git a/list.go b/list.go
index da733ad..661e3e2 100644
--- a/list.go
+++ b/list.go
@@ -15,12 +15,52 @@ func list() {
os.Exit(0)
}
+ if argv.Private {
+ repos := me.forge.Repos.SortByGoPath()
+ for repos.Scan() {
+ repo := repos.Next()
+ if me.forge.IsPrivate(repo.GoPath) {
+ verifyPrint(repo)
+ }
+ }
+ configs := me.forge.Config.SortByGoPath()
+ for configs.Scan() {
+ thing := configs.Next()
+ if thing.Directory {
+ continue
+ }
+ if thing.Private {
+ found := me.forge.Repos.FindByGoPath(thing.GoPath)
+ if found == nil {
+ log.Info("have not downloaded private:", thing.GoPath)
+ } else {
+ log.Info("already downloaded private:", thing.GoPath)
+ }
+ }
+ }
+ os.Exit(0)
+ }
+
if argv.List {
+ var configsave bool
repos := me.forge.Repos.SortByGoPath()
for repos.Scan() {
repo := repos.Next()
+ if me.forge.IsReadOnly(repo) && !argv.ReadOnly {
+ if repo.ReadOnly {
+ continue
+ }
+ log.Info("todo: ConfigSave() readonly flag on repo is wrong", repo.GoPath)
+ repo.ReadOnly = true
+ configsave = true
+ continue
+ }
verifyPrint(repo)
}
+ if configsave {
+ log.Info("should ConfigSave here")
+ me.forge.Repos.ConfigSave()
+ }
os.Exit(0)
}
@@ -59,9 +99,9 @@ func verifyPrint(repo *gitpb.Repo) {
return
}
start := fmt.Sprintf("%-40s %-8s %-20s %-20s %-20s", s["gopath"], s["rtype"], s["cver"], s["mver"], s["cver"])
- if s["url"] != "" {
- end += "(" + s["url"] + ") "
- }
+ //if s["url"] != "" {
+ // end += "(" + s["url"] + ") "
+ //}
if repo.ReadOnly {
end += "(readonly) "
}