diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 511a73c..428d04c 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -10,6 +10,8 @@ before: builds: - env: - CGO_ENABLED=0 + ldflags: + - -X github.com/moyiz/na/cmd.Version={{.Version}} goos: - linux - darwin diff --git a/cmd/root.go b/cmd/root.go index 60931a3..938dd47 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -11,11 +11,14 @@ import ( "github.com/spf13/cobra" ) +var Version string + var rootCmd = &cobra.Command{ - Use: "na", - Short: "CLI tool to effortlessly manage context aware nested shortcuts for shell commands.", - Long: consts.Logo, - Run: listRun, + Use: "na", + Short: "CLI tool to effortlessly manage context aware nested shortcuts for shell commands.", + Long: consts.Logo, + Run: listRun, + Version: Version, } func getConfigFromArgs() (string, error) {