github.com/willmadison/cli@v6.40.1-0.20181018160101-29d5937903ff+incompatible/command/flag/route_path.go (about) 1 package flag 2 3 import ( 4 "fmt" 5 "strings" 6 ) 7 8 type RoutePath struct { 9 Path string 10 } 11 12 func (h *RoutePath) UnmarshalFlag(val string) error { 13 if !strings.HasPrefix(val, "/") { 14 h.Path = fmt.Sprintf("/%s", val) 15 } else { 16 h.Path = val 17 } 18 return nil 19 }