zq "rare surprise" when Zed query clashes with filename
At the time this issue is being filed, Zed is at commit 08c04de.
As divulged in the zq usage docs (emphasis added):
To determine whether the first argument is a query or an input,
zqchecks the local file system for the existence of a file by that name or whether the name is an URL. If no such file or URL exists, it attempts to parse the text as a Zed program. If both checks fail, then an error is reported andzqexits. This heuristic is convenient but can result in a rare surprise when a simple Zed query (like a keyword search) happens to correspond with a file of the same name in the local directory.
As described in #5052, at one time we envisioned a -query flag that could help here. It was described at one time as:
To avoid this [surprise], you can provide the query with the
-queryflag, which specifies the Zed program to run and forces all arguments to be interpreted as inputs.
Of course, there may be other ways to address this.
In any case, this issue can remain open as a reminder that we're currently accepting our users' exposure to this "rare surprise", so comments can be added here if users bump into it and help determine if/when we might want to revisit the topic.