From b6153d4df277e9d2461d72036335df4b775a98e2 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Fri, 29 Mar 2024 00:26:46 -0500 Subject: [PATCH] Add -c argument, for showing *only* responses --- fedi2html.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fedi2html.sh b/fedi2html.sh index f12759e..821e73e 100755 --- a/fedi2html.sh +++ b/fedi2html.sh @@ -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