From 14831832aec19b7f271522923de1953b02bc92a8 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Mon, 16 Mar 2020 13:21:09 -0400 Subject: [PATCH] Support help/usage --- home/bin/fetch-covid-19-cases-usa-ny | 41 ++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/home/bin/fetch-covid-19-cases-usa-ny b/home/bin/fetch-covid-19-cases-usa-ny index 603ce7f..95a039f 100755 --- a/home/bin/fetch-covid-19-cases-usa-ny +++ b/home/bin/fetch-covid-19-cases-usa-ny @@ -5,9 +5,46 @@ # - awk # - hxpipe (packaged in html-xml-utils on Debian and Ubuntu) +VALID_LOCATIONS=' + Albany + Broome + Delaware + Dutchess + Erie + Greene + Herkimer + Monroe + Montgomery + Nassau + Orange + Putnam + Rockland + Saratoga + Schenectady + Suffolk + Tioga + Tompkins + Ulster + Westchester + New York State (Outside of NYC) + New York City: + Total Positive Cases (Statewide) + ' +DEFAULT_LOCATION='New York City:' + +usage() { + printf "Usage: %s [LOCATION]\n" "$0" + printf '\n' + printf 'LOCATION =' + printf '%s\n' "$VALID_LOCATIONS" + printf "Default LOCATION:\n %s\n" "$DEFAULT_LOCATION" + exit 1 +} + case "$1" in - '') location='New York City:';; - *) location="$1";; + '-h') usage;; + '' ) location="$DEFAULT_LOCATION";; + * ) location="$1";; esac curl 'https://health.ny.gov/diseases/communicable/coronavirus/' \ -- 2.20.1