Add Cobra Version

Add a version subcommand with build metadata to an existing Cobra-based Go CLI. Use when the user says "add a version subcommand", "add the version command", "wire up version, commit, and date", "add build metadata to version", "add a /version command to this CLI", "make the version command print commit and build date", or wants `cmd/version.go` plus matching ldflags wired up in `main.go`, `cmd/root.go`, `.goreleaser.yml`, and the `Makefile`. Detects whether the project already has a basic `version` variable or no version wiring at all, then applies the changes idempotently. Pairs with scaffold-go-cli (which seeds the basic version variable) and add-goreleaser-homebrew (which sets up GoReleaser when it is missing).

cboone Updated 3 repo stars

File contents

cboone/agent-harness-plugins commit bf4bf081db

Frequently asked questions

npx get-skill add cboone/add-cobra-version