docs: explain that semicolons separate function arguments (#3685)
The manual's "Defining Functions" section shows only one-argument functions, so it never says how to pass more than one. This adds a short paragraph: arguments are separated by `;` in both `def f(a; b):` and `f(.x; .y)`, and `f(.x, .y)` instead calls a one-argument `f` with the filter `.x, .y`. It also adds an example for each. `tests/man.test` and `jq.1.prebuilt` are regenerated. Fixes #2163
This commit is contained in:
1 parent
e440cccc0a
commit
49fbca1242
3 files changed
+49
No files matched your search
Generated
+8
@@ -888,6 +888,14 @@ def addvalue(f): f as $x | map(. + $x); addvalue(.[0])
|
||||
[[1,2],[10,20]]
|
||||
[[1,2,1,2], [10,20,1,2]]
|
||||
|
||||
def f(a; b): [a, b]; f(.x; .y)
|
||||
{"x":1,"y":2}
|
||||
[1,2]
|
||||
|
||||
def f(a): [a]; f(.x, .y)
|
||||
{"x":1,"y":2}
|
||||
[1,2]
|
||||
|
||||
isempty(empty)
|
||||
null
|
||||
true
|
||||
|
||||
Reference in new issue
Block a user