package contract import ( "github.com/spf13/cobra" "github.com/spf13/viper" ) var Cmd = &cobra.Command{ Use: "contract", Short: "Operations with policy contract", Long: "Operations with policy contract", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { if viper.IsSet(rpcEndpointFlag) { return cmd.Parent().PersistentFlags().Set(rpcEndpointFlag, viper.GetString(rpcEndpointFlag)) } return nil }, } const ( rpcEndpointFlag = "rpc-endpoint" policyHashFlag = "policy-hash" ) func init() { Cmd.PersistentFlags().StringP(rpcEndpointFlag, "r", "", "Neo-go endpoint") Cmd.PersistentFlags().String(policyHashFlag, "policy.frostfs", "NNS name or script hash of policy contract") _ = Cmd.MarkPersistentFlagRequired(rpcEndpointFlag) Cmd.AddCommand(listTargetsCmd) initListTargetsCmd() Cmd.AddCommand(listChainNamesCmd) initListChainNamesCmd() Cmd.AddCommand(listChainsByPrefixCmd) initListChainsByPrefixCmd() }