In the case of a yield with no inputs, the query is run with a single input value of null. This provides a convenient means to run in a "calculator mode" where input is produced by the yield and can be operated upon by the Zed query, e.g.,
zq -z '1+1'
emits
2
However, issues like #5110 from the community indicate there's some potential ambiguity about when zq requires arguments, and this "calculator mode" exception is one such example that might create user confusion. During a recent group discussion, there was consensus that we could reduce some ambiguity by requiring the use of a new command line option to explicitly request the "null input". This would closely follow what many users know from jq:
$ jq --help
...
Command options:
-n, --null-input use `null` as the single input value;
At the time this issue is being filed, Zed is at commit 6fcbee6.
Currently the
zq
usage docs explain:However, issues like #5110 from the community indicate there's some potential ambiguity about when
zq
requires arguments, and this "calculator mode" exception is one such example that might create user confusion. During a recent group discussion, there was consensus that we could reduce some ambiguity by requiring the use of a new command line option to explicitly request the "null
input". This would closely follow what many users know fromjq
: