It’s amazing how the brain works, especially when asleep. I woke up in the middle of last night, suddenly realising I could improve the first jq expression in my solution. I hadn’t even been (consciously) thinking about the post at all.
I’ve updated the post with a small section at the end that describes going from [.,inputs] to [inputs] with the --null-input option.
Lovely! It’s funny, I feel as thought I’m on the cusp of golfing here, but not quite. That’s not the aim of this post (or the one I’ve just written), though - it’s more to explain the filter, with the hope that there’s some demystification for some folks that might lead to them trying jq.
I enjoy reading posts about jq so thought others might too, hence this submission. It sort of also relates to the recent submission about jq and qz which also inspired a post. Thanks.
I love seeing folks write in jq, whether it’s entire modules or short one-line programs. It’s one of the few languages which makes me feel hope for our profession, and it’s becoming a standard tool which distros include by default. Thanks for sharing your experience.
This is a bit meta, but I was wondering - would you folks have any objection in me sharing the main post now here on Lobsters, for which this post was a sort of “prequel”? I’ve just finished it, and it goes into more detail and includes further explorations of jqs functions….
It’s amazing how the brain works, especially when asleep. I woke up in the middle of last night, suddenly realising I could improve the first
jq
expression in my solution. I hadn’t even been (consciously) thinking about the post at all.I’ve updated the post with a small section at the end that describes going from
[.,inputs]
to[inputs]
with the--null-input
option.I think it can be golfed a bit further at the cost of some readability.
jq -Rn '[inputs|{"name":sub("^.+/";"")}]'
Lovely! It’s funny, I feel as thought I’m on the cusp of golfing here, but not quite. That’s not the aim of this post (or the one I’ve just written), though - it’s more to explain the filter, with the hope that there’s some demystification for some folks that might lead to them trying
jq
.I enjoy reading posts about
jq
so thought others might too, hence this submission. It sort of also relates to the recent submission about jq and qz which also inspired a post. Thanks.I love seeing folks write in
jq
, whether it’s entire modules or short one-line programs. It’s one of the few languages which makes me feel hope for our profession, and it’s becoming a standard tool which distros include by default. Thanks for sharing your experience.This is a bit meta, but I was wondering - would you folks have any objection in me sharing the main post now here on Lobsters, for which this post was a sort of “prequel”? I’ve just finished it, and it goes into more detail and includes further explorations of
jq
s functions….Update: Shared: https://lobste.rs/s/misydt/exploring_github_repo_name_distribution
Here’s the solution that I prefer (even though it’s not pure
jq
):