Skip to content

Commit

Permalink
Add alternative COVID mode
Browse files Browse the repository at this point in the history
Implement a COVID mode, enabled via new -c/--covid option with a mandatory
variant specfication. This mode sets epoch to an appropriate value for the
specific COVID variant. Also add initial support for variant 19, in order
to enable displaying the never ending March date.

Signed-off-by: Leif Lindholm <[email protected]>
  • Loading branch information
Leif Lindholm committed Jun 3, 2020
1 parent c440f63 commit 521baba
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions doc/sdate.1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ sdate \- never ending September date
.B sdate
.B [\-e|\-\-epoch
.IB yyyy-mm]
.B [\-c|\-\-covid
.IB vv]
.B [\-l|\-\-lib
.IB library]
.BI [\-\-]
Expand All @@ -40,6 +42,10 @@ mechanism of the dynamic loader. (See
\fB\-e\fR \fIyyyy-mm\fR, \fB\-\-epoch\fR \fIyyyy-mm\fR
Specify an alternative epoch, default is 1993-09.
.TP
\fB\-c\fR \fIvv\fR, \fB\-\-covid\fR \fIvv\fR
Enable COVID mode, for the specified variant. Sets epoch to
an appropriate value for the variant.
.TP
\fB\-l\fR \fIlibrary\fR, \fB\-\-lib\fR \fIlibrary\fR
Specify an alternative wrapper library.
.TP
Expand Down
21 changes: 17 additions & 4 deletions scripts/sdate.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
usage () {
cat - >&2 <<EOF
sdate, never ending September date
usage: sdate [-e|--epoch yyyy-mm] [-l|--lib sdatelib] [-h|--help] [-v|--version]
[--] [command]
usage: sdate [-e|--epoch yyyy-mm] [-c|--covid vv] [-l|--lib sdatelib]
[-h|--help] [-v|--version] [--] [command]
EOF
exit 1
}
Expand All @@ -21,10 +21,10 @@ libfound=no
GETOPTEST=`getopt --version`
case $GETOPTEST in
getopt*) # GNU getopt
TEMP=`getopt -l lib: -l epoch: -l version -l help -- +l:f:e:s:ub:vh "$@"`
TEMP=`getopt -l lib: -l epoch: -l version -l help -- +l:f:e:c:s:ub:vh "$@"`
;;
*) # POSIX getopt ?
TEMP=`getopt l:f:e:s:ub:vh "$@"`
TEMP=`getopt l:f:e:c:s:ub:vh "$@"`
;;
esac

Expand All @@ -46,6 +46,19 @@ while test "X$1" != "X--"; do
SDATE_EPOCH="$1"
export SDATE_EPOCH
;;
-c|--covid)
shift
case "$1" in
19)
SDATE_EPOCH="2020-03"
export SDATE_EPOCH
;;
*)
echo "Unknown COVID variant - supported variants are: 19"
exit 1
;;
esac
;;
-v|--version)
echo "sdate version @VERSION@"
exit 0
Expand Down

0 comments on commit 521baba

Please sign in to comment.