fix(template): trim trailing newline from hooks and show-only output

pull/32566/head
waterWang 3 weeks ago
parent aca518bd99
commit 36432f74b8

@ -127,7 +127,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
continue continue
} }
if client.OutputDir == "" { if client.OutputDir == "" {
fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, m.Manifest) fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, strings.TrimRight(m.Manifest, "\n"))
} else { } else {
newDir := client.OutputDir newDir := client.OutputDir
if client.UseReleaseName { if client.UseReleaseName {
@ -195,7 +195,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
} }
} }
for _, m := range manifestsToRender { for _, m := range manifestsToRender {
fmt.Fprintf(out, "---\n%s\n", m) fmt.Fprintf(out, "---\n%s\n", strings.TrimRight(m, "\n"))
} }
} else { } else {
fmt.Fprintf(out, "%s", manifests.String()) fmt.Fprintf(out, "%s", manifests.String())

Loading…
Cancel
Save