2014-06-03 15:08:58 +00:00
|
|
|
package commands
|
2013-09-23 01:08:31 +00:00
|
|
|
|
|
|
|
import (
|
2014-06-03 15:08:58 +00:00
|
|
|
"github.com/github/git-media/gitmedia"
|
2014-06-26 20:05:23 +00:00
|
|
|
"github.com/spf13/cobra"
|
2013-09-23 01:08:31 +00:00
|
|
|
)
|
|
|
|
|
2014-06-26 20:05:23 +00:00
|
|
|
var (
|
|
|
|
lovesComics bool
|
2013-09-23 01:08:31 +00:00
|
|
|
|
2014-06-26 20:05:23 +00:00
|
|
|
versionCmd = &cobra.Command{
|
|
|
|
Use: "version",
|
2014-06-26 21:22:24 +00:00
|
|
|
Short: "Show the version number",
|
2014-06-26 20:05:23 +00:00
|
|
|
Run: versionCommand,
|
|
|
|
}
|
|
|
|
)
|
2013-09-23 01:08:31 +00:00
|
|
|
|
2014-06-26 20:05:23 +00:00
|
|
|
func versionCommand(cmd *cobra.Command, args []string) {
|
2014-06-26 21:14:11 +00:00
|
|
|
var parent *cobra.Command
|
|
|
|
if p := cmd.Parent(); p != nil {
|
|
|
|
parent = p
|
|
|
|
} else {
|
|
|
|
parent = cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
Print("%s v%s", parent.Name(), gitmedia.Version)
|
2013-12-05 23:27:50 +00:00
|
|
|
|
2014-06-26 20:05:23 +00:00
|
|
|
if lovesComics {
|
|
|
|
Print("Nothing may see Gah Lak Tus and survive!")
|
2013-09-23 01:08:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2014-06-26 20:05:23 +00:00
|
|
|
versionCmd.Flags().BoolVarP(&lovesComics, "comics", "c", false, "easter egg")
|
|
|
|
RootCmd.AddCommand(versionCmd)
|
2013-09-23 01:08:31 +00:00
|
|
|
}
|