add tag handling
This commit is contained in:
parent
96a8f66138
commit
7c520aae88
11
argv.go
11
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)
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue