diff --git a/docs/using_helm.md b/docs/using_helm.md index 5490abbe1..8e096a7e3 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -300,6 +300,12 @@ nodeSelector: kubernetes.io/role: master ``` +Other escape sequences are supported: +- ```\\n``` +- ```\\r``` +- ```\\t``` +- any unsupported sequence will keep the following character + Deeply nested data structures can be difficult to express using `--set`. Chart designers are encouraged to consider the `--set` usage when designing the format of a `values.yaml` file. diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index dae949d8e..c3179f1ec 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -311,6 +311,15 @@ func runesUntil(in io.RuneReader, stop map[rune]bool) ([]rune, rune, error) { if e != nil { return v, next, e } + switch next { + case 'n': + next = '\n' + case 'r': + next = '\r' + case 't': + next = '\t' + } + v = append(v, next) default: v = append(v, r) diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index 22f0e753a..14acc3f2f 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -294,6 +294,10 @@ func TestParseSet(t *testing.T) { str: "nested[1][1]=1", expect: map[string]interface{}{"nested": []interface{}{nil, []interface{}{nil, 1}}}, }, + { + str: "escapes=hello\\n\\tworld", + expect: map[string]interface{}{"escapes": "hello\n\tworld"}, + }, } for _, tt := range tests {