From e300719241a8bfe62db429f349315ff15816062d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 22 Sep 2025 23:02:59 -0500 Subject: [PATCH] cleanup tag list --- argv.go | 14 +++---------- doTag.go | 40 +++++++++++++++++++++---------------- doc.go | 61 ++++++++++++++++++++++++++++---------------------------- 3 files changed, 57 insertions(+), 58 deletions(-) diff --git a/argv.go b/argv.go index f6caabe..bc43f63 100644 --- a/argv.go +++ b/argv.go @@ -155,7 +155,7 @@ func DoAutoComplete(pb *prep.Auto) { case "checkout": pb.Autocomplete2("devel master user") case "clean": - fmt.Println("--force verify --repo") + pb.Autocomplete2("") case "commit": pb.Autocomplete2("--all") case "config": @@ -171,19 +171,11 @@ func DoAutoComplete(pb *prep.Auto) { case "merge": pb.Autocomplete2("devel master --all") case "normal": - fmt.Println("on off") + pb.Autocomplete2("on off") case "pull": - fmt.Println("--force check") + pb.Autocomplete2("--force check") case "patch": fmt.Println("check get list repos submit show") - case "user": - fmt.Println("--force") - case "devel": - fmt.Println("--force") - case "master": - fmt.Println("") - case "verify": - fmt.Println("user devel master") case "tag": fmt.Println("list --delete clean") default: diff --git a/doTag.go b/doTag.go index 90c3ec1..a316fa8 100644 --- a/doTag.go +++ b/doTag.go @@ -39,7 +39,7 @@ func doTag() error { if argv.Tag.List != nil { repo := findCurrentPwdRepoOrDie() - tagTablePB := makeTagTablePB(repo.Tags) + tagTablePB := makeTagTablePB(repo, repo.Tags) // tbox := win.Bottom.Box().SetProgName("TBOX") // t.SetParent(tbox) tagTablePB.MakeTable() @@ -80,40 +80,46 @@ func doTag() error { return nil } -func makeTagTablePB(pb *gitpb.GitTags) *gitpb.GitTagsTable { +func makeTagTablePB(repo *gitpb.Repo, pb *gitpb.GitTags) *gitpb.GitTagsTable { t := pb.NewTable("tagList") t.NewUuid() col := t.AddHash() col.Width = 12 - col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string { - _, ref := filepath.Split(r.GetRefname()) - return ref + col = t.AddStringFunc("bashash", func(tag *gitpb.GitTag) string { + _, base := filepath.Split(tag.Refname) + cmd, err := repo.RunStrict([]string{"git", "log", "-1", base, "--format=%H"}) + if err != nil { + return "err" + } + if len(cmd.Stdout) == 0 { + return "" + } + return cmd.Stdout[0] }) - col.Width = 16 - // col.Width = -1 - - col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time { - // todo - return time.Now() - }) - col.Width = 6 + col.Width = 12 col = t.AddTimeFunc("ctime", func(tag *gitpb.GitTag) time.Time { // todo return tag.Creatordate.AsTime() }) - col.Width = 16 + col.Width = 4 - col = t.AddIntFunc("int", func(tag *gitpb.GitTag) int { + col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time { // todo - return 3 + return time.Now() }) col.Width = 4 - col = t.AddSubject() + col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string { + _, ref := filepath.Split(r.GetRefname()) + return ref + }) col.Width = 16 + col = t.AddSubject() + col.Width = -1 + return t } diff --git a/doc.go b/doc.go index be6970a..4d88f15 100644 --- a/doc.go +++ b/doc.go @@ -1,40 +1,41 @@ /* - forge -- a tool to manage lots of git repos. forge includes a GUI and TUI. forge only executes the 'git' command. Everything it does, you can run by hand with 'git'. Options: - --debugger open the debugger window - --logger open the log.* control window - --gui GUI select the plugin (andlabs,gocui,etc) - --gui-verbose enable all logging - --bash generate bash completion - --bash generate bash completion - --connect CONNECT forge url - --all git commit --all - --build BUILD build a repo - --install INSTALL install a repo - --forge-rebuild download and rebuild forge - --force try to strong arm things - --verbose show more output - --help, -h display this help and exit - --version display version and exit + + --debugger open the debugger window + --logger open the log.* control window + --gui GUI select the plugin (andlabs,gocui,etc) + --gui-verbose enable all logging + --bash generate bash completion + --bash generate bash completion + --connect CONNECT forge url + --all git commit --all + --build BUILD build a repo + --install INSTALL install a repo + --forge-rebuild download and rebuild forge + --force try to strong arm things + --verbose show more output + --help, -h display this help and exit + --version display version and exit Commands: - help New to forge? This is for you.' - checkout switch branches using 'git checkout' - clean start over at the beginning - commit 'git commit' but errors out if on wrong branch - config show your .config/forge/ settings - dirty show dirty git repos - fetch run 'git fetch master' - gui open the gui - list print a table of the current repos - merge merge branches - normal set every repo to the default state for software development - patch make patchsets - pull run 'git pull' - tag manage git tags + + help New to forge? This is for you.' + checkout switch branches using 'git checkout' + clean start over at the beginning + commit 'git commit' but errors out if on wrong branch + config show your .config/forge/ settings + dirty show dirty git repos + fetch run 'git fetch master' + gui open the gui + list print a table of the current repos + merge merge branches + normal set every repo to the default state for software development + patch make patchsets + pull run 'git pull' + tag manage git tags */ package main