summaryrefslogtreecommitdiffstats
path: root/docs/content/manual/manual.yml
diff options
context:
space:
mode:
authorpkoppstein <pkoppstein@gmail.com>2023-07-13 18:17:42 -0400
committerGitHub <noreply@github.com>2023-07-14 00:17:42 +0200
commit07ef97c414ef0370683a30a392223610912025fb (patch)
tree072cfee6f5603e17bea471755416fde7a258e2c5 /docs/content/manual/manual.yml
parent4b1ac7c95fc72b1fd59211f5af46cdf13f4ad478 (diff)
debug/1 (#2710)
* debug/1 This def ensures the output of debug(m1,m2) is kept together. Closes #2709 #2111 #2112
Diffstat (limited to 'docs/content/manual/manual.yml')
-rw-r--r--docs/content/manual/manual.yml29
1 files changed, 24 insertions, 5 deletions
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml
index 9dbd1b19..24db2daf 100644
--- a/docs/content/manual/manual.yml
+++ b/docs/content/manual/manual.yml
@@ -3075,13 +3075,32 @@ sections:
to invoke jq with the -n command-line option, otherwise
the first entity will be lost.
- - title: "`debug`"
+ - title: "`debug`, `debug(msgs)`"
body: |
- Causes a debug message based on the input value to be
- produced. The jq executable wraps the input value with
- `["DEBUG:", <input-value>]` and prints that and a newline on
- stderr, compactly. This may change in the future.
+ These two filters are like `.` but have as a side-effect the
+ production of one or more messages on stderr.
+
+ The message produced by the `debug` filter has the form
+
+ ["DEBUG:",<input-value>]
+
+ where `<input-value>` is a compact rendition of the input
+ value. This format may change in the future.
+
+ The `debug(msgs)` filter is defined as `(msgs | debug | empty), .`
+ thus allowing great flexibility in the content of the message,
+ while also allowing multi-line debugging statements to be created.
+
+ For example, the expression:
+
+ 1 as $x | 2 | debug("Entering function foo with $x == \($x)", .) | (.+1)
+
+ would produce the value 3 but with the following two lines
+ being written to stderr:
+
+ ["DEBUG:","Entering function foo with $x == 1"]
+ ["DEBUG:",2]
- title: "`stderr`"
body: |