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 "(or something like it) to fetch even these foreign files."
echo
echo " -c only print the responses (children) of a post"
echo " -h print this message and exit"
echo " -I display posts in reverse-chronological order"
echo " -R do not recursively display posts responses"
}
while getopts 'hRI' arg; do
while getopts 'hcIR' arg; do
case $arg in
h)
usage
exit 0
;;
c)
NO_PARENT="1"
;;
I)
REVERSE_ORDER="1"
;;
@ -302,5 +306,10 @@ fi
POST="$(fetch_post "$URL")"
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