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"`
|
Normal *NormalCmd `arg:"subcommand:normal" help:"set every repo to the default state for software development"`
|
||||||
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
|
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
|
||||||
Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
|
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"`
|
URL string `arg:"--connect" help:"forge url"`
|
||||||
All bool `arg:"--all" help:"git commit --all"`
|
All bool `arg:"--all" help:"git commit --all"`
|
||||||
Build string `arg:"--build" help:"build a repo"`
|
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"`
|
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 {
|
type ConfigAddCmd struct {
|
||||||
Path string `arg:"--path" help:"absolute path of the git repo"`
|
Path string `arg:"--path" help:"absolute path of the git repo"`
|
||||||
GoPath string `arg:"--gopath" help:"GO 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("")
|
fmt.Println("")
|
||||||
case "verify":
|
case "verify":
|
||||||
fmt.Println("user devel master")
|
fmt.Println("user devel master")
|
||||||
|
case "tag":
|
||||||
|
fmt.Println("list --delete clean")
|
||||||
default:
|
default:
|
||||||
if argv[0] == ARGNAME {
|
if argv[0] == ARGNAME {
|
||||||
// list the subcommands here
|
// 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)
|
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
|
||||||
|
}
|
5
main.go
5
main.go
|
@ -121,6 +121,11 @@ func main() {
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if argv.Tag != nil {
|
||||||
|
doTag()
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
|
||||||
if argv.Normal != nil {
|
if argv.Normal != nil {
|
||||||
if argv.Normal.On != nil {
|
if argv.Normal.On != nil {
|
||||||
if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL {
|
if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL {
|
||||||
|
|
Loading…
Reference in New Issue