get.porter.sh/porter@v1.3.0/pkg/pkgmgmt/uninstall.go (about)

     1  package pkgmgmt
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  	"strings"
     7  )
     8  
     9  type UninstallOptions struct {
    10  	Name string
    11  }
    12  
    13  func (o *UninstallOptions) Validate(args []string) error {
    14  	switch len(args) {
    15  	case 0:
    16  		return errors.New("no name was specified")
    17  	case 1:
    18  		o.Name = strings.ToLower(args[0])
    19  		return nil
    20  	default:
    21  		return fmt.Errorf("only one positional argument may be specified, the name, but multiple were received: %s", args)
    22  
    23  	}
    24  }