mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
776c550654
Includes version command and makefile integration along with docs command
36 lines
814 B
Go
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()
|
|
}
|