From e8c60a4fcfb14df4f772bafb8a29d188e27ba6b0 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 15 Apr 2024 15:58:12 +0200 Subject: [PATCH] mention array notation in the docs --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 84fe347..3f40ae9 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Or worse, where you had to count spaces in yaml? Fear no more, sackmesser will t Operations have a signature like `op_name(path, args*)` where -* path is dot delimited, you could use quotes in case field names contain spaces, dots, commas, etc: +* path is dot delimited, you could use quotes in case field names contain spaces, dots, commas, etc. For array access you can use array notation: ``` echo '{ "a" : { "test prop": 1 } }' | sackmesser mod 'set(a."test prop", "test")' @@ -27,6 +27,16 @@ Operations have a signature like `op_name(path, args*)` where } ``` + ``` + echo '{ "a" : { "test prop": [ 1 , true ] } }' | sackmesser mod 'set(a."test prop"[1], "test")' + "a": { + "test prop": [ + 1, + "test" + ] + } + ``` + * Zero or more arguments are required for an operation. An argument could be one of - a number - `null`