mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
bb63d7e60e
Co-authored-by: Rishichandra Wawhal <rishichandra.wawhal@gmail.com> Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> Co-authored-by: Aravind <aravindkp@outlook.in> Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com> Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
36 lines
907 B
Go
36 lines
907 B
Go
package commands
|
|
|
|
import (
|
|
"github.com/hasura/graphql-engine/cli"
|
|
"github.com/pkg/errors"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newMetadataInconsistencyStatusCmd(ec *cli.ExecutionContext) *cobra.Command {
|
|
opts := &metadataInconsistencyListOptions{
|
|
EC: ec,
|
|
}
|
|
|
|
metadataInconsistencyStatusCmd := &cobra.Command{
|
|
Use: "status",
|
|
Short: "Check if the metadata is inconsistent or not",
|
|
SilenceUsage: true,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
opts.EC.Spin("reading metadata status...")
|
|
err := opts.read()
|
|
opts.EC.Spinner.Stop()
|
|
if err != nil {
|
|
return errors.Wrap(err, "failed to read metadata status")
|
|
}
|
|
if opts.isConsistent {
|
|
opts.EC.Logger.Println("metadata is consistent")
|
|
} else {
|
|
return errors.New("metadata is inconsistent, use list command to see the objects")
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
|
|
return metadataInconsistencyStatusCmd
|
|
}
|