github.com/chenbh/concourse/v6@v6.4.2/fly/commands/internal/flaghelpers/output_pair_flag.go (about)

     1  package flaghelpers
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  type OutputPairFlag struct {
     9  	Name string
    10  	Path string
    11  }
    12  
    13  func (pair *OutputPairFlag) UnmarshalFlag(value string) error {
    14  	vs := strings.SplitN(value, "=", 2)
    15  	if len(vs) != 2 {
    16  		return fmt.Errorf("invalid output pair '%s' (must be name=path)", value)
    17  	}
    18  
    19  	pair.Name = vs[0]
    20  	pair.Path = vs[1]
    21  
    22  	return nil
    23  }