git-lfs/commands/command_version.go
risk danger olson a12cdc889f RegisterCommand() can no longer disable commands
the config is available at init(), so isCommandEnabled() checks can be
pulled out of the RegisterCommand() callback, simplifying its signature.
2016-09-01 10:09:38 -06:00

26 lines
465 B
Go

package commands
import (
"github.com/github/git-lfs/httputil"
"github.com/spf13/cobra"
)
var (
lovesComics bool
)
func versionCommand(cmd *cobra.Command, args []string) {
Print(httputil.UserAgent)
if lovesComics {
Print("Nothing may see Gah Lak Tus and survive!")
}
}
func init() {
RegisterCommand("version", versionCommand, func(cmd *cobra.Command) {
cmd.PreRun = nil
cmd.Flags().BoolVarP(&lovesComics, "comics", "c", false, "easter egg")
})
}