pretty.sh uses consistent naming now. Also finally did following command to show communities you are subscribed to.

This commit is contained in:
Zergling_man 2023-11-26 18:27:03 +11:00
parent b3185b2d25
commit ba29b1491d
6 changed files with 24 additions and 23 deletions

View File

@ -2,7 +2,7 @@
#Well, it seems to work now.
pkgname=clemmy
pkgver=0.1.6
pkgver=0.1.7
pkgrel=1
pkgdesc='A pure bash client for lemmy, with multiaccount support.'
arch=('any')

View File

@ -12,7 +12,7 @@ while getopts "a:hi:v" o;do case "${o}" in
a) select_account $OPTARG;;
i) INSTANCE=$OPTARG;;
h) echo $actions; exit;;
v) echo 0.1.4; exit;;
v) echo 0.1.7; exit;;
esac done
shift $((OPTIND-1))

View File

@ -1,7 +1,7 @@
#Community hoardan
follow(){ post "community/follow" '{"community_id":'$1',"follow":true}'; }
unfollow(){ post "community/follow" '{"community_id":'$1',"follow":false}'; }
following(){ echo "use <home> instead"; } # Maybe this will help.
following(){ getauth "community/list" ".communities | $communities_jq" "type_=Subscribed"; } # Alright it's time
comcreate(){ namedget desc "The community's display name (can be edited later)"; post "community" '{"name":"'$1'","title":"'"$desc"'"}'; }
comedit(){ echo "stub"; }

View File

@ -1,7 +1,7 @@
#Lurkan
notifs(){ getauth "user/replies" ".replies | reverse | $notifs"; }
notifs(){ getauth "user/replies" ".replies | reverse | $notifs_jq"; }
notifs2(){ echo "use mentions instead"; }
mentions(){ getauth "user/mention" ".mentions | reverse | $notifs"; }
home(){ getauth "post/list" ".posts | $posts" "type_=Subscribed"; }
mentions(){ getauth "user/mention" ".mentions | reverse | $notifs_jq"; }
home(){ getauth "post/list" ".posts | $posts_jq" "type_=Subscribed"; }
#This has to get complex now -.-
comments(){ getauth "post" "(.post_view | $showpost)" "id=$1"; getauth "comment/list" "(.comments | reverse | $comments_view)" "post_id=$1&sort=New"; }
comments(){ getauth "post" "(.post_view | $full_post_jq)" "id=$1"; getauth "comment/list" "(.comments | reverse | $comments_jq)" "post_id=$1&sort=New"; }

View File

@ -1,7 +1,7 @@
#Post hoardan
save(){ put "post/save" '{"post_id":'$1',"save":true}'; }
unsave(){ put "post/save" '{"post_id":'$1',"save":false}'; }
load(){ getauth "post/list" ".posts | .[] | $postsummary" "type_=All&saved_only=true"; }
load(){ getauth "post/list" ".posts | .[] | $short_post_jq" "type_=All&saved_only=true"; }
#Postan
freepost(){ getbody; post "post" '{"community_id":'$1',"name":"'${*:2}'","body":"'$body'"}'; }
shitpost(){ getbody; postid=$1; parentid=$2; if [ -z $parentid ]; then parentid=null; fi; post "comment" '{"post_id":'$postid',"parent_id":'$parentid',"content":"'$body'"}'; }

View File

@ -1,23 +1,24 @@
# Please don't abuse jq like this
showpost='(.post | (.id | tostring)+" "+(.name | tostring)),
full_post_jq='(.post | (.id | tostring)+" "+(.name | tostring)),
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published,
(.body // .content)),
""'
postsummary='(.post | (.id | tostring)+" "+(.name | tostring)),
(.body // .content))'
short_post_jq='(.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)'
comment_jq='(.comment | .path[2:])+", "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published,
(.body // .content)),
""'
(.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)+":",
notif_jq='(.comment | (.parent_id | tostring)+"->"+(.id | tostring))+" ("+(.post | (.id | tostring))+"), "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published,
(.body // .content)),
""'
(.body // .content))'
community_jq='(.community | (.id | tostring)+" "+.actor_id,.description),
.subscribed,
(.counts | [.subscribers,.posts,.comments,.users_active_week] | join(" "))'
comments_view=".[] | $showcomment"
posts=".[] | $showpost"
notifs=".[] | $notif"
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")