github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/command/flag/v7_route_path.go (about)

     1  package flag
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  type V7RoutePath struct {
     9  	Path string
    10  }
    11  
    12  func (h *V7RoutePath) UnmarshalFlag(val string) error {
    13  	if val != "" && !strings.HasPrefix(val, "/") {
    14  		h.Path = fmt.Sprintf("/%s", val)
    15  	} else {
    16  		h.Path = val
    17  	}
    18  
    19  	return nil
    20  }