clemmy/pretty.sh

24 lines
1013 B
Bash
Raw Normal View History

2023-01-17 01:07:40 +11:00
# Please don't abuse jq like this
showpost='(.post | (.id | tostring)+" "+(.name | tostring)),
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published,
(.body // .content)),
""'
postsummary='(.post | (.id | tostring)+" "+(.name | tostring)),
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published),
""'
showcomment='(.comment | (.parent_id | tostring)+"->"+(.id | tostring))+", "+(.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='(.comment | (.parent_id | tostring)+"->"+(.id | tostring))+" ("+(.post | (.id | tostring))+"), "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published,
(.body // .content)),
""'
comments_view=".[] | $showcomment"
2023-01-17 01:07:40 +11:00
posts=".[] | $showpost"
notifs=".[] | $notif"