github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/command/flag/docker.go (about) 1 package flag 2 3 import ( 4 "fmt" 5 6 "github.com/docker/distribution/reference" 7 flags "github.com/jessevdk/go-flags" 8 ) 9 10 type DockerImage struct { 11 Path string 12 } 13 14 func (d *DockerImage) UnmarshalFlag(val string) error { 15 _, err := reference.Parse(val) 16 if err != nil { 17 return &flags.Error{ 18 Type: flags.ErrRequired, 19 Message: fmt.Sprintf("invalid docker reference: %s", err.Error()), 20 } 21 } 22 d.Path = val 23 return nil 24 }