version.go 368 字节
Newer Older
P
Phodal Huang 已提交
1 2 3 4
package cmd

import (
	"fmt"
P
Phodal Huang 已提交
5
	"github.com/phodal/coca/cmd/config"
P
Phodal Huang 已提交
6 7 8 9
	"github.com/spf13/cobra"
)

func init() {
10
	versionCmd.SetOut(output)
P
Phodal Huang 已提交
11 12 13 14 15
	rootCmd.AddCommand(versionCmd)
}

var versionCmd = &cobra.Command{
	Use:   "version",
P
Phodal Huang 已提交
16
	Short: "version",
P
Phodal Huang 已提交
17
	Run: func(cmd *cobra.Command, args []string) {
18
		fmt.Fprintf(output, "Coca Version: " + config.VERSION + " -- HEAD \n")
P
Phodal Huang 已提交
19 20
	},
}