From db1f9f525ee2010e6d2c0f1866e07dea4bd18f9d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 21:50:55 +0000 Subject: [PATCH 1/2] Update version output format --- main.go | 10 +++++++++- main_test.go | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b719e3a..c90d7a8 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "io/fs" "log" "os" + "runtime" "runtime/debug" "path/filepath" "strings" @@ -47,7 +48,7 @@ func main() { flag.Parse() if *showVersion { - fmt.Println("Version:", Version) + fmt.Println(formatVersionOutput("clip4llm", Version)) return } @@ -397,3 +398,10 @@ func parseCommaSeparated(input string) []string { } return result } + +func formatVersionOutput(projectName, version string) string { + if version != "" && !strings.HasPrefix(version, "v") { + version = "v" + version + } + return fmt.Sprintf("%s version %s (%s, %s/%s)", projectName, version, runtime.Version(), runtime.GOOS, runtime.GOARCH) +} diff --git a/main_test.go b/main_test.go index 8edd9b7..a2d664e 100644 --- a/main_test.go +++ b/main_test.go @@ -1,8 +1,40 @@ package main -import "testing" +import ( + "fmt" + "runtime" + "testing" +) // TestGreet is a basic unit test for the Greet function func TestGreet(t *testing.T) { main() } + +func TestFormatVersionOutput(t *testing.T) { + tests := []struct { + name string + version string + want string + }{ + { + name: "adds v prefix when missing", + version: "1.2.3", + want: fmt.Sprintf("clip4llm version v1.2.3 (%s, %s/%s)", runtime.Version(), runtime.GOOS, runtime.GOARCH), + }, + { + name: "preserves existing v prefix", + version: "v2.3.4", + want: fmt.Sprintf("clip4llm version v2.3.4 (%s, %s/%s)", runtime.Version(), runtime.GOOS, runtime.GOARCH), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := formatVersionOutput("clip4llm", tt.version) + if got != tt.want { + t.Fatalf("formatVersionOutput() = %q, want %q", got, tt.want) + } + }) + } +} From 82e80bb781271434c36e0b8b74479d5684ba0943 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 21:52:20 +0000 Subject: [PATCH 2/2] Validate version output changes --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f282f6b..60ae790 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/UnitVectorY-Labs/clip4llm -go 1.26 // GOVERSION +go 1.26.0 // GOVERSION require github.com/atotto/clipboard v0.1.4