|
|
|
|
|
by rgrau
1752 days ago
|
|
A very useful function in jq is "join", which I use a lot to cook the final shape of the data (many times used with fzf/dmenu) Here's a simple way to list and browse github issues of a given user/repo: #!/usr/bin/env sh
browse_url() {
firefox http://github.com/$1/issues/$2
}
issue=$(curl https://api.github.com/repos/$1/issues |
jq -r 'map([(.number|tostring), .title] | join(" | ")) | join("\n")' |
dmenu -i -l 10 |
awk "{print \$1}")
browse_url $1 $issue
Although the `| join("\n")` part could be done in a more idomatic way with just `[]`, sometimes the manual way are still clearer to me: map([(.number|tostring), .title] | join(" | "))[]
|
|