2023-01-17 01:07:40 +11:00
|
|
|
# Please don't abuse jq like this
|
2023-11-26 18:27:03 +11:00
|
|
|
full_post_jq='(.post | (.id | tostring)+" "+(.name | tostring)),
|
2023-01-17 01:07:40 +11:00
|
|
|
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
|
|
|
|
((.comment // .post) | .published,
|
2023-11-26 18:27:03 +11:00
|
|
|
(.body // .content))'
|
|
|
|
short_post_jq='(.post | (.id | tostring)+" "+(.name | tostring)),
|
2023-01-17 01:07:40 +11:00
|
|
|
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
|
2023-11-26 18:27:03 +11:00
|
|
|
((.comment // .post) | .published)'
|
|
|
|
comment_jq='(.comment | .path[2:])+", "+(.creator.display_name // .creator.name)+":",
|
2023-01-17 01:07:40 +11:00
|
|
|
((.comment // .post) | .published,
|
2023-11-26 18:27:03 +11:00
|
|
|
(.body // .content))'
|
2023-01-17 01:07:40 +11:00
|
|
|
#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.
|
2023-11-26 18:27:03 +11:00
|
|
|
notif_jq='(.comment | (.parent_id | tostring)+"->"+(.id | tostring))+" ("+(.post | (.id | tostring))+"), "+(.creator.display_name // .creator.name)+":",
|
2023-01-17 01:07:40 +11:00
|
|
|
((.comment // .post) | .published,
|
2023-11-26 18:27:03 +11:00
|
|
|
(.body // .content))'
|
|
|
|
community_jq='(.community | (.id | tostring)+" "+.actor_id,.description),
|
|
|
|
.subscribed,
|
|
|
|
(.counts | [.subscribers,.posts,.comments,.users_active_week] | join(" "))'
|
2023-01-17 01:07:40 +11:00
|
|
|
|
2023-11-26 18:27:03 +11:00
|
|
|
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")
|