graphql-engine/cli/commands/version.go
Shahidh K Muhammed 776c550654
[cli] add docs and build tools (#3)
Includes version command and makefile integration along with docs command
2018-06-28 11:10:18 +05:30

23 lines
527 B
Go

package commands
import (
"github.com/hasura/graphql-engine/cli"
"github.com/spf13/cobra"
)
func NewVersionCmd(ec *cli.ExecutionContext) *cobra.Command {
versionCmd := &cobra.Command{
Use: "version",
Short: "Print the CLI version",
SilenceUsage: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return ec.Prepare()
},
RunE: func(cmd *cobra.Command, args []string) error {
ec.Logger.Infof("hasura cli version: %s", ec.GetVersion())
return nil
},
}
return versionCmd
}