github.com/mutagen-io/mutagen@v0.18.0-rc1/cmd/arguments.go (about)

     1  package cmd
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  // DisallowArguments is a Cobra arguments validator that disallows positional
    10  // arguments. It is an alternative to cobra.NoArgs, which treats arguments as
    11  // command names and returns a somewhat cryptic error message.
    12  func DisallowArguments(_ *cobra.Command, arguments []string) error {
    13  	if len(arguments) > 0 {
    14  		return errors.New("command does not accept arguments")
    15  	}
    16  	return nil
    17  }