graphql-engine/cli/commands/root.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

36 lines
814 B
Go

// Package commands contains the definition for all the commands present in
// Hasura CLI.
package commands
import (
"github.com/hasura/graphql-engine/cli"
"github.com/spf13/cobra"
)
// rootCmd is the main "hasura" command
var rootCmd = &cobra.Command{
Use: "hasura",
Short: "Hasura GraphQL Engine command line tool",
SilenceUsage: true,
SilenceErrors: true,
}
func init() {
ec := &cli.ExecutionContext{}
rootCmd.AddCommand(
NewInitCmd(ec),
NewConsoleCmd(ec),
NewMetadataCmd(ec),
NewMigrateCmd(ec),
NewVersionCmd(ec),
NewDocsCmd(ec),
)
f := rootCmd.PersistentFlags()
f.StringVar(&ec.LogLevel, "log-level", "INFO", "log level (DEBUG, INFO, WARN, ERROR, FATAL)")
}
// Execute executes the command and returns the error
func Execute() error {
return rootCmd.Execute()
}