github.com/sleungcy/cli@v7.1.0+incompatible/command/flag/droplet.go (about) 1 package flag 2 3 import ( 4 "fmt" 5 "strings" 6 ) 7 8 type Droplet struct { 9 Path string 10 } 11 12 func (d *Droplet) UnmarshalFlag(val string) error { 13 if !strings.HasPrefix(val, "/") { 14 d.Path = fmt.Sprintf("/%s", val) 15 } else { 16 d.Path = val 17 } 18 return nil 19 }