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

docs minor bugs: example for comma operator; typo in alternative operator #10

Closed
ghost opened this issue Oct 21, 2012 · 3 comments
Closed
Labels

Comments

@ghost
Copy link

ghost commented Oct 21, 2012

(1). minor bug in the docs, for "," (comma) operator:

jq '[.user, .projects[]]'
Input   {"user":"stedolan", "projects": ["jq", "wikiflow"]}
Output  "stedolan"
       "jq"
        "wikiflow"

There should be a dot before the query's "[" (otherwise, the query is identical to the example for array construction, but with different results), like this:

jq '.[.user, .projects[]]'

(2). Alternative operator - //
The second paragraph begins

This is useful for providing defaults: .foo or 1

It should be:

This is useful for providing defaults: .foo // 1
@stedolan
Copy link
Contributor

You're right that it's wrong, but I don't think your fix fixes it (what you posted would look up the username and each project as a key in the input object).

The program that's there would, as you say, produce an array. I'll remove the brackets so that it produces the intended output.

@ghost
Copy link
Author

ghost commented Oct 21, 2012

Oh, of course you're right. BTW: I think you didn't see the second typo I edited in.

@stedolan
Copy link
Contributor

missed that, fixed now. Thanks!

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

No branches or pull requests

2 participants