From d82f77303fd9786bad39c6e31e74e506ff9dc301 Mon Sep 17 00:00:00 2001 From: cpendery Date: Thu, 14 Sep 2023 20:33:06 -0400 Subject: [PATCH] feat: add version command Signed-off-by: cpendery --- cmd/version.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cmd/version.go diff --git a/cmd/version.go b/cmd/version.go new file mode 100644 index 0000000..6e18dfa --- /dev/null +++ b/cmd/version.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var ( + version string +) + +func init() { + rootCmd.AddCommand(versionCmd) +} + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "view clac's version", + Args: cobra.ExactArgs(0), + RunE: runVersionCmd, +} + +func runVersionCmd(_ *cobra.Command, args []string) error { + fmt.Printf("clac version: %s", version) + return nil +}