-
Notifications
You must be signed in to change notification settings - Fork 503
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
add 'json_stringify' and 'jaq' (jq) built-in functions #2557
Comments
Just has a very strong backwards compatibility guarantee, so I don't think we could expose something like We would probably either wind up having to use an unmaintained, older version, have to make a backwards incompatible change upgrading to a new version. That being said, can you give some example concrete use cases? I want to understand what this provides. |
Hm, would that same argument then apply to any external library that exposes a syntax defined by that library? If so, isn't most of the discussion in #2532 also moot? In any case, wouldn't it still be possible that it is easier/better to incorporate something mature (the original https://github.com/jqlang/jq has been around for a while, I am not aware of any time that either jq or jaq has made a backward-incompatible change, and both have been quite heavily tested), but anyway incorporating a snapshot wouldn't be any different from what Apple did with a bunch of BSD code. |
Sure, we could look at how this could be used as an alternative to the self-described "not very elegant"
With json_stringify and jaq, the result is possibly a bit more elegant, and is fully shell-less (at least for the looping logic):
(Note that the above assumes that the "--raw" output flag is set which is missing the diff code I posted earlier) |
So I just did a little experiment by adding two functons to my own just repo:
json_stringify()
andjaq()
(rust implementation of jq)They worked fabulously. I would like to propose incorporating them into the official
just
.These alone can fill a huge portion of the gap that is needed to make a no-shell option viable (in fact, that's what I used them for), such as #1570 and #2458, as well as related use cases discussed in #528, #537, #2379, #2080, and probably many others.
Granted, using jq is a particular approach that may or may suit the user and for any given case might not be the perfect choice compared with potential external alternatives-- but consider:
Thoughts?
FYI, the changes in function.rs were merely as follows (note: this is a super quick-and-dirty whip-up for illustrative purposes). Happy to submit a PR:
The text was updated successfully, but these errors were encountered: