Add ioccc-status.1, bug fix ioccc-status.sh
The man page is in /man/man1/. It is not clear to me if man/man1 should
be under another directory but that can be decided later and if
necessary it can be moved over. The man page has a few examples. More
could be contrived if necessary. It has no SEE ALSO section because it
is not clear to me what should be linked to (perhaps the IOCCC
website?). I felt like I should write this man page first, in
particular, because I wrote the script too and the benefit is I
discovered some bugs in the script as well that are now fixed.
The script only checked if the status.json file was readable but it did
not check if it is writable. It should check for both and it now does.
The exit code is the same as if the file does not exist, is not a
regular file or not readable: 1. It also now explicitly exits 0 at the
end of the script. The version was updated to
IOCCC_STATUS_SCRIPT_VERSION="0.0.5-0 2024-01-22" # major.minor.release-patch YYYY-MM-DD
When fixing the script some things crossed my mind that might be worth
considering. First of all if dry-mode is specified (-N) does it really
need to have a status.json file arg specified? It might or might not.
Second should there be an option to create a new status.json file (if
the one does not exist)? These are perhaps worth considering and
wouldn't be hard to implement if these are desirable.
This commit is contained in:
1 parent
7fb2a3192e
commit
cf62d3ab94
2 files changed
+157
-2
No files matched your search
+7
-2
@@ -24,7 +24,7 @@
|
||||
#
|
||||
# The -G option lets one set the path to grep(1).
|
||||
#
|
||||
export IOCCC_STATUS_SCRIPT_VERSION="0.0.4-0 2024-01-22" # major.minor.release-patch YYYY-MM-DD
|
||||
export IOCCC_STATUS_SCRIPT_VERSION="0.0.5-0 2024-01-22" # major.minor.release-patch YYYY-MM-DD
|
||||
|
||||
SED="$(type -P sed)"
|
||||
GREP="$(type -P grep)"
|
||||
@@ -129,13 +129,17 @@ if [[ ! -e $STATUS_JSON_FILE ]]; then
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f $STATUS_JSON_FILE ]]; then
|
||||
echo "$0: ERROR: status.json not a file: $STATUS_JSON_FILE" 1>&2
|
||||
echo "$0: ERROR: status.json not a regular file: $STATUS_JSON_FILE" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -r $STATUS_JSON_FILE ]]; then
|
||||
echo "$0: ERROR: status.json not a readable file: $STATUS_JSON_FILE" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -w $STATUS_JSON_FILE ]]; then
|
||||
echo "$0: ERROR: status.json is not a writable file: $STATUS_JSON_FILE" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check that $SED is an executable file
|
||||
if [[ ! -x "$SED" ]]; then
|
||||
@@ -238,3 +242,4 @@ if [[ -n "$STATUS_FLAG" ]]; then
|
||||
echo "$0: updated contest status to: \"$STATUS\"" 1>&2
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
Reference in new issue
Block a user