Add -c argument, for showing *only* responses

This commit is contained in:
Jaidyn Ann 2024-03-29 00:26:46 -05:00
parent 9f69c3d54b
commit b6153d4df2

View File

@ -269,18 +269,22 @@ usage() {
echo "if privacy or total archival, is a concern, to use wget(1)s --mirror" echo "if privacy or total archival, is a concern, to use wget(1)s --mirror"
echo "(or something like it) to fetch even these foreign files." echo "(or something like it) to fetch even these foreign files."
echo echo
echo " -c only print the responses (children) of a post"
echo " -h print this message and exit" echo " -h print this message and exit"
echo " -I display posts in reverse-chronological order" echo " -I display posts in reverse-chronological order"
echo " -R do not recursively display posts responses" echo " -R do not recursively display posts responses"
} }
while getopts 'hRI' arg; do while getopts 'hcIR' arg; do
case $arg in case $arg in
h) h)
usage usage
exit 0 exit 0
;; ;;
c)
NO_PARENT="1"
;;
I) I)
REVERSE_ORDER="1" REVERSE_ORDER="1"
;; ;;
@ -302,5 +306,10 @@ fi
POST="$(fetch_post "$URL")" POST="$(fetch_post "$URL")"
RESPONSES="$(fetch_post_context "$URL" | context_to_responses)" RESPONSES="$(fetch_post_context "$URL" | context_to_responses)"
render_post "$POST" "$RESPONSES" 0
if test -n "$NO_PARENT"; then
render_responses "$POST" "$RESPONSES" 0
else
render_post "$POST" "$RESPONSES" 0
fi