root cmd shows help and version
This commit is contained in:
parent
4c2793165f
commit
9e95c6ef68
@ -16,7 +16,14 @@ var (
|
||||
)
|
||||
|
||||
func versionCommand(cmd *cobra.Command, args []string) {
|
||||
Print("%s v%s", cmd.Parent().Name(), gitmedia.Version)
|
||||
var parent *cobra.Command
|
||||
if p := cmd.Parent(); p != nil {
|
||||
parent = p
|
||||
} else {
|
||||
parent = cmd
|
||||
}
|
||||
|
||||
Print("%s v%s", parent.Name(), gitmedia.Version)
|
||||
|
||||
if lovesComics {
|
||||
Print("Nothing may see Gah Lak Tus and survive!")
|
||||
|
@ -24,7 +24,8 @@ var (
|
||||
Use: "git-media",
|
||||
Short: "Git Media provides large file support to Git.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Git Media, yo")
|
||||
versionCommand(cmd, args)
|
||||
cmd.Help()
|
||||
},
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user