Force input to start at templates/ directory so path matching works as expected.

Signed-off-by: Aaron Stults <aaron710@gmail.com>
pull/9170/head
Aaron Stults 5 years ago
parent d9c5754dfc
commit e61e7a9c61

@ -119,6 +119,17 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
missing := true
// Use linux-style filepath separators to unify user's input path
f = filepath.ToSlash(f)
// the following path matching assumes starting at the "templates/" directory
// so we will split the input path on "/" and reslice starting at "templates" if it exists
fileSplit := strings.Split(f, "/")
for i,v := range fileSplit {
if v == "templates" {
fileSplit = fileSplit[i:]
break;
}
}
f = strings.Join(fileSplit, "/")
for _, manifestKey := range manifestsKeys {
manifest := splitManifests[manifestKey]
submatch := manifestNameRegex.FindStringSubmatch(manifest)

Loading…
Cancel
Save