-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implicit stdin support / Unintuitive behaviour when omitting '-' #5110
Comments
@Dessix: Thanks for this feedback. Indeed, the core Zed development team has also recognized there's room for improvement here. It helps to have the input of a user that's coming at this with fresh eyes. We'll have another round of discussion and see what we can improve here. I'll circle back with findings. |
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
This commit fixes an issue where the wrong error message was returned for a single argument zq invocation where the argument is a valid Zed query but the query contains no source. Closes #5110
Wait, doesn’t that just announce the unintuitive behavior instead of correcting it? |
@Dessix: Indeed, a PR merge triggered the early closure of this issue, so I'm reopening. As you noted, #5119 just rationalizes the tool's current behavior so it's no longer contradicting the docs. There's more material improvements we still plan to make that should more directly address the unintuitive behavior. We'll circle back with more detail soon. |
Thank you @philrz ; I'll keep following this to make sure it doesn't get lost beneath GitHub noise then ^^ I believe the |
@Dessix: Yes, it certainly was the Here's the more detailed response to your concerns. The main improvement we still intend to make is what's described in #5116. That should help with the unexpected behavior you cited in this query:
The reason that was happening was due to the "calculator mode" described in the closing of the Usage section of the When we add what's described in #5116, then Regarding your other finding:
That's expected. The single quotes in
This is not unique to Finally, regarding a possible shift to an overall:
Your point is understood, and we're still discussing that one. |
When attempting to onboard from
jq
, I've had somewhat unintuitive results exploring basic commands:echo '{a:1,b:2,c:3}' | zq 'yield this' -
=>{a:1,b:2,c:3}
So far so good, though the docs list the default query when omitting one as being
*
, so let's try that:echo '{a:1,b:2,c:3}' | zq '*' -
=>{a:1,b:2,c:3}
Cool, equivalent behaviour to what I get from having no query:
echo '{a:1,b:2,c:3}' | zq -
=>{a:1,b:2,c:3}
Except... This option of omitting the query entirely leads into some interesting territory. According to the
--help
docs:So what happens if we make a request with a valid query and allow standard input to be assumed as the input?
echo '{a:1,b:2,c:3}' | zq 'yield this'
=>null
Here's our first unexpected behaviour: not passing a query seems to ignore
stdin
. I thought maybe this was due to-
counting as a valid zed query, but the following experiment shows otherwise:echo '{a:1,b:2,c:3}' | zq '-' -
=>{a:1,b:2,c:3}
So let's try passing the real "default" query given by the CLI docs:
So the default zed query of '*' is not a valid zed query?
... Except when you pass stdin explicitly:
echo '{a:1,b:2,c:3}' | zq '*' -
=>{a:1,b:2,c:3}
As a new user, the issue seems to be that allowing implicit queries is a significant footgun and should be replaced with the more POSIX-friendly implicit
stdin
input convention. There may be some nuance here that makes shell scripting a lower-priority target than some other workflow that thezq
tutorial hasn't introduced, but this is not apparent from day one, and the surprising nature of the CLI behaviour makes me hesitant to adopt this in lieu of JQ.The text was updated successfully, but these errors were encountered: