pretty.sh uses consistent naming now. Also finally did following command to show communities you are subscribed to.
This commit is contained in:
parent
b3185b2d25
commit
ba29b1491d
2
PKGBUILD
2
PKGBUILD
|
@ -2,7 +2,7 @@
|
||||||
#Well, it seems to work now.
|
#Well, it seems to work now.
|
||||||
|
|
||||||
pkgname=clemmy
|
pkgname=clemmy
|
||||||
pkgver=0.1.6
|
pkgver=0.1.7
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc='A pure bash client for lemmy, with multiaccount support.'
|
pkgdesc='A pure bash client for lemmy, with multiaccount support.'
|
||||||
arch=('any')
|
arch=('any')
|
||||||
|
|
|
@ -12,7 +12,7 @@ while getopts "a:hi:v" o;do case "${o}" in
|
||||||
a) select_account $OPTARG;;
|
a) select_account $OPTARG;;
|
||||||
i) INSTANCE=$OPTARG;;
|
i) INSTANCE=$OPTARG;;
|
||||||
h) echo $actions; exit;;
|
h) echo $actions; exit;;
|
||||||
v) echo 0.1.4; exit;;
|
v) echo 0.1.7; exit;;
|
||||||
esac done
|
esac done
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#Community hoardan
|
#Community hoardan
|
||||||
follow(){ post "community/follow" '{"community_id":'$1',"follow":true}'; }
|
follow(){ post "community/follow" '{"community_id":'$1',"follow":true}'; }
|
||||||
unfollow(){ post "community/follow" '{"community_id":'$1',"follow":false}'; }
|
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"'"}'; }
|
comcreate(){ namedget desc "The community's display name (can be edited later)"; post "community" '{"name":"'$1'","title":"'"$desc"'"}'; }
|
||||||
comedit(){ echo "stub"; }
|
comedit(){ echo "stub"; }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#Lurkan
|
#Lurkan
|
||||||
notifs(){ getauth "user/replies" ".replies | reverse | $notifs"; }
|
notifs(){ getauth "user/replies" ".replies | reverse | $notifs_jq"; }
|
||||||
notifs2(){ echo "use mentions instead"; }
|
notifs2(){ echo "use mentions instead"; }
|
||||||
mentions(){ getauth "user/mention" ".mentions | reverse | $notifs"; }
|
mentions(){ getauth "user/mention" ".mentions | reverse | $notifs_jq"; }
|
||||||
home(){ getauth "post/list" ".posts | $posts" "type_=Subscribed"; }
|
home(){ getauth "post/list" ".posts | $posts_jq" "type_=Subscribed"; }
|
||||||
#This has to get complex now -.-
|
#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"; }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#Post hoardan
|
#Post hoardan
|
||||||
save(){ put "post/save" '{"post_id":'$1',"save":true}'; }
|
save(){ put "post/save" '{"post_id":'$1',"save":true}'; }
|
||||||
unsave(){ put "post/save" '{"post_id":'$1',"save":false}'; }
|
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
|
#Postan
|
||||||
freepost(){ getbody; post "post" '{"community_id":'$1',"name":"'${*:2}'","body":"'$body'"}'; }
|
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'"}'; }
|
shitpost(){ getbody; postid=$1; parentid=$2; if [ -z $parentid ]; then parentid=null; fi; post "comment" '{"post_id":'$postid',"parent_id":'$parentid',"content":"'$body'"}'; }
|
31
pretty.sh
31
pretty.sh
|
@ -1,23 +1,24 @@
|
||||||
# Please don't abuse jq like this
|
# 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)+":",
|
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
|
||||||
((.comment // .post) | .published,
|
((.comment // .post) | .published,
|
||||||
(.body // .content)),
|
(.body // .content))'
|
||||||
""'
|
short_post_jq='(.post | (.id | tostring)+" "+(.name | tostring)),
|
||||||
postsummary='(.post | (.id | tostring)+" "+(.name | tostring)),
|
|
||||||
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
|
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
|
||||||
((.comment // .post) | .published),
|
((.comment // .post) | .published)'
|
||||||
""'
|
comment_jq='(.comment | .path[2:])+", "+(.creator.display_name // .creator.name)+":",
|
||||||
showcomment='(.comment | .path[2:])+", "+(.creator.display_name // .creator.name)+":",
|
|
||||||
((.comment // .post) | .published,
|
((.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.
|
#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,
|
((.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"
|
multi_jq(){ echo '.[] | '"$1"',""'; }
|
||||||
posts=".[] | $showpost"
|
comments_jq=$(multi_jq "$comment_jq")
|
||||||
notifs=".[] | $notif"
|
posts_jq=$(multi_jq "$full_post_jq")
|
||||||
|
notifs_jq=$(multi_jq "$notif_jq")
|
||||||
|
communities_jq=$(multi_jq "$community_jq")
|
Loading…
Reference in New Issue
Block a user