github.com/chenbh/concourse/v6@v6.4.2/fly/commands/internal/flaghelpers/resource_flag.go (about) 1 package flaghelpers 2 3 import ( 4 "errors" 5 "strings" 6 ) 7 8 type ResourceFlag struct { 9 PipelineName string 10 ResourceName string 11 } 12 13 func (resource *ResourceFlag) UnmarshalFlag(value string) error { 14 vs := strings.SplitN(value, "/", 2) 15 16 if len(vs) != 2 { 17 return errors.New("argument format should be <pipeline>/<resource>") 18 } 19 20 resource.PipelineName = vs[0] 21 resource.ResourceName = vs[1] 22 23 return nil 24 }