graphql-engine/cli/commands/root.go

30 lines
590 B
Go
Raw Normal View History

2018-06-24 16:40:48 +03:00
package commands
2018-06-24 16:47:01 +03:00
import (
"github.com/hasura/graphql-engine/cli"
"github.com/spf13/cobra"
)
2018-06-24 16:40:48 +03:00
var rootCmd = &cobra.Command{
Use: "hasura",
Short: "Hasura GraphQL Engine command line tool",
SilenceUsage: true,
SilenceErrors: true,
}
func init() {
2018-06-24 16:47:01 +03:00
ec := &cli.ExecutionContext{}
rootCmd.AddCommand(
NewInitCmd(ec),
NewConsoleCmd(ec),
NewMetadataCmd(ec),
NewMigrateCmd(ec),
)
f := rootCmd.PersistentFlags()
f.StringVar(&ec.LogLevel, "log-level", "INFO", "log level (DEBUG, INFO, WARN, ERROR, FATAL)")
2018-06-24 16:40:48 +03:00
}
func Execute() error {
return rootCmd.Execute()
}