summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go11
-rw-r--r--doTag.go54
-rw-r--r--main.go5
3 files changed, 69 insertions, 1 deletions
diff --git a/argv.go b/argv.go
index 7285464..8dc5ae5 100644
--- a/argv.go
+++ b/argv.go
@@ -28,6 +28,7 @@ type args struct {
Normal *NormalCmd `arg:"subcommand:normal" help:"set every repo to the default state for software development"`
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
+ Tag *TagCmd `arg:"subcommand:tag" help:"manage git tags"`
URL string `arg:"--connect" help:"forge url"`
All bool `arg:"--all" help:"git commit --all"`
Build string `arg:"--build" help:"build a repo"`
@@ -79,6 +80,12 @@ type PullCmd struct {
Patches *EmptyCmd `arg:"subcommand:patches" help:"only check repos with patches"`
}
+type TagCmd struct {
+ List *EmptyCmd `arg:"subcommand:list" help:"list the tags"`
+ Clean *EmptyCmd `arg:"subcommand:clean" help:"clean out old and duplicate tags"`
+ Delete string `arg:"--delete" help:"delete a tag"`
+}
+
type ConfigAddCmd struct {
Path string `arg:"--path" help:"absolute path of the git repo"`
GoPath string `arg:"--gopath" help:"GO path of the git repo"`
@@ -186,10 +193,12 @@ func DoAutoComplete(argv []string) {
fmt.Println("")
case "verify":
fmt.Println("user devel master")
+ case "tag":
+ fmt.Println("list --delete clean")
default:
if argv[0] == ARGNAME {
// list the subcommands here
- fmt.Println("help list checkout clean commit dirty fetch gui normal merge patch pull")
+ fmt.Println("help list checkout clean commit dirty fetch gui normal merge patch pull tag")
}
}
os.Exit(0)
diff --git a/doTag.go b/doTag.go
new file mode 100644
index 0000000..d2d5ca6
--- /dev/null
+++ b/doTag.go
@@ -0,0 +1,54 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// checks that repos are in a "normal" state
+
+import (
+ "time"
+
+ "go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
+)
+
+func doTag() error {
+ if argv.Tag.List != nil {
+ log.Info("list tags here")
+ return nil
+ }
+
+ ns := "go.wit.com/apps/forge"
+ repo := me.forge.Repos.FindByNamespace(ns)
+ if repo == nil {
+ return log.Errorf("could not find %s", ns)
+ }
+
+ tagTablePB := makeTagTablePB(repo.Tags)
+ // tbox := win.Bottom.Box().SetProgName("TBOX")
+ // t.SetParent(tbox)
+ tagTablePB.MakeTable()
+ tagTablePB.PrintTable()
+
+ log.Info("do other tag stuff here")
+ return nil
+}
+
+func makeTagTablePB(pb *gitpb.GitTags) *gitpb.GitTagsTable {
+ t := pb.NewTable("tagList")
+ t.NewUuid()
+
+ sf := t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string {
+ return r.GetRefname()
+ })
+ sf.Width = 16
+
+ colAge := t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time {
+ // todo
+ return time.Now()
+ })
+ t.AddHash()
+ t.AddSubject()
+ colAge.Width = 4
+ return t
+}
diff --git a/main.go b/main.go
index 007f4a4..d5fdf52 100644
--- a/main.go
+++ b/main.go
@@ -121,6 +121,11 @@ func main() {
okExit("")
}
+ if argv.Tag != nil {
+ doTag()
+ okExit("")
+ }
+
if argv.Normal != nil {
if argv.Normal.On != nil {
if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL {