Skip to content

Commit

Permalink
DA-515 Add a flag validator
Browse files Browse the repository at this point in the history
Signed-off-by: Dzianis Andreyenka <andreenkodn@gmail.com>
  • Loading branch information
denisandreenko committed Oct 11, 2023
1 parent 56248c1 commit c1c550c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/init_tezos.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ var initTezosCmd = &cobra.Command{
// By default we turn off multiparty mode while it's not supported yet
initOptions.MultipartyEnabled = false
initOptions.TokenProviders = []string{}
if err := validateTezosFlags(); err != nil {
return err
}
if err := initCommon(args); err != nil {
return err
}
Expand All @@ -56,6 +59,13 @@ var initTezosCmd = &cobra.Command{
},
}

func validateTezosFlags() error {
if initOptions.RemoteNodeURL == "" {
return fmt.Errorf("you must provide 'remote-node-url' flag as local node mode is not supported")
}
return nil
}

func init() {
initTezosCmd.Flags().IntVar(&initOptions.BlockPeriod, "block-period", -1, "Block period in seconds. Default is variable based on selected blockchain provider.")
initTezosCmd.Flags().StringVar(&initOptions.ContractAddress, "contract-address", "", "Do not automatically deploy a contract, instead use a pre-configured address")
Expand Down

0 comments on commit c1c550c

Please sign in to comment.