github.com/jenkins-x/draft-repo@v0.9.0/pkg/draft/draftpath/home.go (about) 1 package draftpath 2 3 import ( 4 "path/filepath" 5 ) 6 7 // Home describes the location of a CLI configuration. 8 // 9 // This helper builds paths relative to a Draft Home directory. 10 type Home string 11 12 // Packs returns the path to the Draft starter packs. 13 func (h Home) Packs() string { 14 return filepath.Join(string(h), "packs") 15 } 16 17 // Path returns Home with elements appended. 18 func (h Home) Path(elem ...string) string { 19 p := []string{h.String()} 20 p = append(p, elem...) 21 return filepath.Join(p...) 22 } 23 24 // Plugins returns the path to the Draft plugins. 25 func (h Home) Plugins() string { 26 return filepath.Join(string(h), "plugins") 27 } 28 29 // String returns Home as a string. 30 // 31 // Implements fmt.Stringer. 32 func (h Home) String() string { 33 return string(h) 34 }