summaryrefslogtreecommitdiff
path: root/doTag.go
blob: d2d5ca6fccd79aba4effb121e061d166f4e8ee61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
}