Skip to content
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

Update compile.c to correctly inform user making substitutions with sub("a","b") instead of sub("a";"b") #3204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jidhub
Copy link

@jidhub jidhub commented Nov 15, 2024

echo '{"f":"a"}' | jq '.f | sub("a","b")'
above line generates the following unclear error message:

jq: error: sub/1 is not defined at <top-level>, line 1:
.f | sub("a","b")
jq: 1 compile error

This patch is changing the error message to:
jq: error: sub/1 is not defined, also happens when you separate arguments by comma (,) instead of semicolon (;), at <top-level>, line 1:
.f | sub("a","b")
jq: 1 compile error

because the correct command is:

echo '{"f":"a"}' | jq '.f | sub("a";"b")'

echo '{"c":"aa"}' | jq '.c | sub("aa";"bb")'

change the error message for:
echo '{"c":"aa"}' | jq '.c | sub("aa","bb")'
@jidhub jidhub changed the title Update compile.c to Update compile.c to correctly inform user making substitutions with sub("a","b") instead of sub("a";"b") Nov 15, 2024
@itchyny
Copy link
Contributor

itchyny commented Nov 16, 2024

Could this message show only when seached for 1 arity filter (no semicolon), and there is a filter with the same name but the arity if commas are replaced by semicolon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants