version.go 350 B

123456789101112131415161718192021
  1. package cmd
  2. import (
  3. "fmt"
  4. "github.com/spf13/cobra"
  5. )
  6. // versionCmd represents the version command
  7. var versionCmd = &cobra.Command{
  8. Use: "version",
  9. Short: "Prints the current version",
  10. Long: ``,
  11. Run: func(cmd *cobra.Command, args []string) {
  12. fmt.Printf("Version %s\n", AppVersion)
  13. },
  14. }
  15. func init() {
  16. rootCmd.AddCommand(versionCmd)
  17. }