~ecs/ecs.d2evs.net

251c8b8624d2f6cc1481c7a36fe7c4b5e34ae76d — Eyal Sawady 6 months ago 0743504
Implement get_date
1 files changed, 22 insertions(+), 1 deletions(-)

M _config.sh
M _config.sh => _config.sh +22 -1
@@ 14,8 14,29 @@ get_description() {
	echo "TODO: get description"
}

month_name() {
	case "$1" in
	01) echo "Jan" ;;
	02) echo "Feb" ;;
	03) echo "Mar" ;;
	04) echo "Apr" ;;
	05) echo "May" ;;
	06) echo "Jun" ;;
	07) echo "Jul" ;;
	08) echo "Aug" ;;
	09) echo "Sep" ;;
	10) echo "Oct" ;;
	11) echo "Nov" ;;
	12) echo "Dec" ;;
	*) echo "ERR" ;; # TODO: is this the best fallback?
	esac
}

get_date() {
	echo "TODO: get date"
	year="$(basename "$1" | cut -d- -f1)"
	month="$(basename "$1" | cut -d- -f2)"
	day="$(basename "$1" | cut -d- -f3)"
	printf "%s %s %s 00:00:00 +0000\n" "$day" "$(month_name "$month")" "$year"
}

case $input in