github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/cmd/flags.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  )
     6  
     7  // MarkFlagRequired marks a flag added to a cobra command as required. Panics
     8  // if the flag has not been added to the cobra command (indicates misconfiguration
     9  // or typo).
    10  func MarkFlagRequired(command *cobra.Command, flagName string) {
    11  	err := command.MarkFlagRequired(flagName)
    12  	if err != nil {
    13  		panic("marked unknown flag as required: " + err.Error())
    14  	}
    15  }