We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e1048df + 663e33c commit 4d3e492Copy full SHA for 4d3e492
pkg/template/template.go
@@ -272,6 +272,7 @@ func sprigFuncMap() template.FuncMap {
272
"hasPrefix",
273
"hasSuffix",
274
"regexMatch",
275
+ "replace",
276
}
277
txtFuncMap := sprig.TxtFuncMap()
278
funcMap := template.FuncMap{}
pkg/template/template_test.go
@@ -409,6 +409,14 @@ func TestExecute(t *testing.T) {
409
},
410
wantW: "true",
411
412
+ {
413
+ name: "replace",
414
+ args: args{
415
+ json: strings.NewReader(`{"product":"GitHub CLI\n"}`),
416
+ template: `{{ .product | replace "\n" "" }}`,
417
+ },
418
+ wantW: "GitHub CLI",
419
420
421
for _, tt := range tests {
422
t.Run(tt.name, func(t *testing.T) {
0 commit comments