clemmy/pretty.sh

24 lines
977 B
Bash

# 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 | .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='(.comment | (.parent_id | tostring)+"->"+(.id | tostring))+" ("+(.post | (.id | tostring))+"), "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published,
(.body // .content)),
""'
comments_view=".[] | $showcomment"
posts=".[] | $showpost"
notifs=".[] | $notif"