24 lines
1.2 KiB
Bash
24 lines
1.2 KiB
Bash
# Please don't abuse jq like this
|
|
full_post_jq='(.post | (.id | tostring)+" "+(.name | tostring)),
|
|
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
|
|
((.comment // .post) | .published,
|
|
(.body // .content))'
|
|
short_post_jq='(.post | (.id | tostring)+" "+(.name | tostring)),
|
|
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
|
|
((.comment // .post) | .published)'
|
|
comment_jq='(.comment | .path[2:])+", "+(.creator.display_name // .creator.name)+":",
|
|
((.comment // .post) | .published,
|
|
(.body // .content))'
|
|
#Split this out because I specifically do want to include post IDs in some places. Or rather, I only don't want to include them on the comments view.
|
|
notif_jq='(.comment | (.parent_id | tostring)+"->"+(.id | tostring))+" ("+(.post | (.id | tostring))+"), "+(.creator.display_name // .creator.name)+":",
|
|
((.comment // .post) | .published,
|
|
(.body // .content))'
|
|
community_jq='(.community | (.id | tostring)+" "+.actor_id,.description),
|
|
.subscribed,
|
|
(.counts | [.subscribers,.posts,.comments,.users_active_week] | join(" "))'
|
|
|
|
multi_jq(){ echo '.[] | '"$1"',""'; }
|
|
comments_jq=$(multi_jq "$comment_jq")
|
|
posts_jq=$(multi_jq "$full_post_jq")
|
|
notifs_jq=$(multi_jq "$notif_jq")
|
|
communities_jq=$(multi_jq "$community_jq") |