Skip to content

Commit 72fe84d

Browse files
committed
fix: hide commit and build time when unavailable
Only display commit hash and build time in --version output when they have actual values. When using 'go install', these show as 'none' and 'unknown' which clutters the output. Before (go install): plum version v0.3.5 commit: none built: unknown After (go install): plum version v0.3.5 After (Homebrew/binaries): plum version v0.3.5 commit: 3b0135b built: 2026-01-11T07:51:08Z
1 parent 3b0135b commit 72fe84d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

cmd/plum/main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ func main() {
5454
if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") {
5555
ver, cmt, bDate := getVersion()
5656
fmt.Printf("plum version %s\n", ver)
57-
fmt.Printf(" commit: %s\n", cmt)
58-
fmt.Printf(" built: %s\n", bDate)
57+
58+
// Only show commit and build time if available
59+
if cmt != "none" && cmt != "" {
60+
fmt.Printf(" commit: %s\n", cmt)
61+
}
62+
if bDate != "unknown" && bDate != "" {
63+
fmt.Printf(" built: %s\n", bDate)
64+
}
5965
os.Exit(0)
6066
}
6167

0 commit comments

Comments
 (0)