experimental-cli/cmd/version.go

23 lines
371 B
Go
Raw Normal View History

2020-08-02 18:59:32 +00:00
package cmd
import (
2020-08-02 19:10:32 +00:00
"fmt"
2020-08-02 18:59:32 +00:00
"pigeon/pigeon"
2020-08-02 19:10:32 +00:00
"github.com/spf13/cobra"
2020-08-02 18:59:32 +00:00
)
2020-08-02 19:10:32 +00:00
var versionCmd = &cobra.Command{
Use: "version",
Short: "Show the version of the Pigeon CLI tool.",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
result := fmt.Sprintf("Pigeon v%s", pigeon.Version)
fmt.Println(result)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}