fix(cli): mark from flag as required for squash (close #3400) (#3500)

This commit is contained in:
Ashish Rao 2019-12-10 15:48:58 +05:30 committed by Shahidh K Muhammed
parent 9fe6070663
commit 094bbc8760

View File

@ -12,6 +12,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
mig "github.com/hasura/graphql-engine/cli/migrate/cmd"
@ -51,6 +52,9 @@ func newMigrateSquashCmd(ec *cli.ExecutionContext) *cobra.Command {
f.String("access-key", "", "access key for Hasura GraphQL Engine")
f.MarkDeprecated("access-key", "use --admin-secret instead")
// mark flag as required
migrateSquashCmd.MarkFlagRequired("from")
// need to create a new viper because https://github.com/spf13/viper/issues/233
v.BindPFlag("endpoint", f.Lookup("endpoint"))
v.BindPFlag("admin_secret", f.Lookup("admin-secret"))