add quick-readme2index.sh, improve all-run.sh and readme2index.sh

Improved `all-run.sh` and `readme2index.sh` so that
certain command line options (e.g., -p, -P, -u, -U ...)
are only passed along to other tools if they are
given on the command line.

all-run.sh VERSION changed from "1.1.1 2024-01-19"
to "1.1.2 2024-01-20",

readme2index.sh VERSION changed from "1.1 2024-01-16"
to "1.1.1 2024-01-20".

Added `quick-readme2index.sh` that only calls
`readme2index.sh` if the `index.html` is not
a non-empty file, or of either `.winner.json`
and/or `README.md` is newer than `index.html`.

Updated all `index.html` files because the
the file contains a comment that includes
the newly modified readme2index.sh VERSION.
This commit is contained in:
Landon Curt Noll committed 2024-01-21 00:21:40 -08:00
1 parent e14325556c
commit d414b6d71f
325 files changed
+1352 -497

No files matched your search

+58 -9
View File
@@ -49,7 +49,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
# set variables referenced in the usage message
#
export VERSION="1.1.1 2024-01-19"
export VERSION="1.1.2 2024-01-20"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -73,6 +73,11 @@ export DOCROOT_URL_SLASH="/temp-test-ioccc/"
export NOOP=
export DO_NOT_PROCESS=
export EXIT_CODE="0"
#
export P_FLAG_FOUND=
export CAP_P_FLAG_FOUND=
export U_FLAG_FOUND=
export CAP_U_FLAG_FOUND=
# usage
#
@@ -105,7 +110,6 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
tool the tool to run over all winners
tool_options tool command line options to use before YYYY/dir
NOTE: You must use -- after the tool command line option and before 'tool_options'
Exit codes:
0 all OK
@@ -141,7 +145,7 @@ while getopts :hv:Vd:nNp:P:u:U: flag; do
N) DO_NOT_PROCESS="-N"
;;
p) PANDOC_WRAPPER="$OPTARG"
;;
P_FLAG_FOUND="-p" ;;
P) # parse -P optstr
case "$OPTARG" in
*"'"*)
@@ -159,10 +163,13 @@ while getopts :hv:Vd:nNp:P:u:U: flag; do
*) ;;
esac
PANDOC_WRAPPER_OPTSTR="$OPTARG"
CAP_P_FLAG_FOUND="-P"
;;
u) REPO_URL="$OPTARG"
U_FLAG_FOUND="-u"
;;
U) TOP_URL="$OPTARG"
CAP_U_FLAG_FOUND="-U"
;;
\?) echo "$0: ERROR: invalid option: -$OPTARG" 1>&2
echo 1>&2
@@ -210,6 +217,50 @@ case "$#" in
;;
esac
# clear options we will add to tools
#
export OPTSTR=
# add '-p tool' options to tool arguments
#
if [[ -n $P_FLAG_FOUND && -n $PANDOC_WRAPPER ]]; then
if [[ -z $OPTSTR ]]; then
OPTSTR="-p \"$PANDOC_WRAPPER\""
else
OPTSTR="$OPTSTR -p \"$PANDOC_WRAPPER\""
fi
fi
# add '-P optstr' options to tool arguments
#
if [[ -n $CAP_P_FLAG_FOUND && -n $PANDOC_WRAPPER_OPTSTR ]]; then
if [[ -z $OPTSTR ]]; then
OPTSTR="-P \"$PANDOC_WRAPPER_OPTSTR\""
else
OPTSTR="$OPTSTR -P \"$PANDOC_WRAPPER_OPTSTR\""
fi
fi
# add '-u repo_url' options to tool arguments
#
if [[ -n $U_FLAG_FOUND && -n $REPO_URL ]]; then
if [[ -z $OPTSTR ]]; then
OPTSTR="-u \"$REPO_URL\""
else
OPTSTR="$OPTSTR -u \"$REPO_URL\""
fi
fi
# add '-U top_url' options to tool arguments
#
if [[ -n $CAP_U_FLAG_FOUND && -n $TOP_URL ]]; then
if [[ -z $OPTSTR ]]; then
OPTSTR="-U \"$TOP_URL\""
else
OPTSTR="$OPTSTR -U \"$TOP_URL\""
fi
fi
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_URL")
@@ -324,6 +375,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: INC_DIR=$INC_DIR" 1>&2
echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
echo "$0: debug[3]: OPTSTR=$OPTSTR" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
fi
@@ -479,11 +531,9 @@ for YYYY in $(< "$TOP_FILE"); do
#
if [[ -z $NOOP ]]; then
if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: about to run: $TOOL -d \"$TOPDIR\" -p \"$PANDOC_WRAPPER\"" \
"-P \"$PANDOC_WRAPPER_OPTSTR\" -u \"$REPO_URL\" -U \"$TOP_URL\" $TOOL_OPTIONS \"$WINNER_PATH\"" 1>&2
echo "$0: debug[5]: about to run: $TOOL $OPTSTR $TOOL_OPTIONS \"$WINNER_PATH\"" 1>&2
fi
eval "$TOOL" -d '"'"$TOPDIR"'"' -p '"'"$PANDOC_WRAPPER"'"' -P '"'"$PANDOC_WRAPPER_OPTSTR"'"' \
-u '"'"$REPO_URL"'"' -U '"'"$TOP_URL"'"' "$TOOL_OPTIONS" '"'"$WINNER_PATH"'"'
eval "$TOOL" "$OPTSTR" "$TOOL_OPTIONS" '"'"$WINNER_PATH"'"'
status="$?"
if [[ $status -ne 0 ]]; then
echo "$0: ERROR: tool: $TOOL failed, error: $status" 1>&2
@@ -494,8 +544,7 @@ for YYYY in $(< "$TOP_FILE"); do
# report disabled by -n
#
elif [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: because of -n, did not run: $TOOL -d \"$TOPDIR\" -p \"$PANDOC_WRAPPER\"" \
"-P \"$PANDOC_WRAPPER_OPTSTR\" -u \"$REPO_URL\" -U \"$TOP_URL\" $TOOL_OPTIONS \"$WINNER_PATH\"" 1>&2
echo "$0: debug[5]: because of -n, did not run: $TOOL $OPTSTR $TOOL_OPTIONS \"$WINNER_PATH\"" 1>&2
fi
# report disabled by -N