diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7881288..aff0061 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -17,6 +17,8 @@ builds: ignore: - goos: windows goarch: "386" + ldflags: + - -s -w -X git.asdf.cafe/abs3nt/gospt/src.cmd.Version={{.Version}} archives: - format: tar.gz diff --git a/src/cmd/version.go b/src/cmd/version.go new file mode 100644 index 0000000..8f232f4 --- /dev/null +++ b/src/cmd/version.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var Version = "v0.0.47" + +func init() { + rootCmd.AddCommand(versionCmd) +} + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Prints current verison", + Run: version, +} + +func version(cmd *cobra.Command, args []string) { + fmt.Printf("Gospt: %s\n", Version) +}