feat(version): print the version like gh version

tea version and --version printed "Version: development<TAB>golang:
1.27.2". They now print "tea version 1.0.0 (2026-10-01)", the release
notes URL for tagged releases, and "built with go1.27.2" with the build
tags. Builds from go install take the module version from the build
info, and the date comes from the commit the binary was built from.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-11 23:50:46 +02:00
1 parent 85034c524f
commit 83dd4f7938
3 files changed
+75 -13

No files matched your search

+2 -1
View File
@@ -16,6 +16,7 @@ import (
"unicode"
"gitea.dev/tea/internal/clierr"
"gitea.dev/tea/internal/version"
"github.com/spf13/cobra"
"github.com/stretchr/testify/require"
)
@@ -68,7 +69,7 @@ func TestCommandLineEdgeCases(t *testing.T) {
err = Execute(context.Background(), deps, []string{"config", "list", "--jq", ".[", "--remote", "-h"})
require.ErrorContains(t, err, "invalid --jq expression")
require.NoError(t, Execute(context.Background(), deps, []string{"--version"}))
require.NotContains(t, out.String(), "tea version")
require.Equal(t, version.Format()+"\n", out.String())
}
func TestAliasesAfterGlobalFlagsAndNestedHelp(t *testing.T) {