From 73fef605a5531a9e79f474bd72926377cce90c29 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Tue, 22 Mar 2022 13:57:47 +0100 Subject: [PATCH] First commit --- README.md | 6 +++++- badgy | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 badgy diff --git a/README.md b/README.md index c5ca330..ea6bc67 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # badgy -Very simple ninebadge shell client \ No newline at end of file +Very simple ninebadge shell client + +# Depends + +This works with "curlie" (https://curlie.io) diff --git a/badgy b/badgy new file mode 100755 index 0000000..271fc10 --- /dev/null +++ b/badgy @@ -0,0 +1,40 @@ +#!/bin/bash + +CURLIE="curlie -I" + +clockin() +{ + ${CURLIE} POST ${BADGEURL}/clockin key=${KEY} +} + +clockout() +{ + ${CURLIE} POST ${BADGEURL}/clockout key=${KEY} +} + +validate() +{ + ${CURLIE} POST ${BADGEURL}/validate key=${KEY} dateof=$(date +'%Y-%m-%d') +} + +devalidate() +{ + ${CURLIE} POST ${BADGEURL}/devalidate key=${KEY} dateof=$(date +'%Y-%m-%d') +} + + +show() +{ + ${CURLIE} -I POST ${BADGEURL}/showtimers key=${KEY} dateof=$(date +'%Y-%m-%d') +} + +if [ -e "${HOME}/.badgyrc" ]; then + . ${HOME}/.badgyrc +else + echo "${HOME}/.badgyrc file is missing, I need it" + echo "Create it with this command:" + echo " echo 'BADGEURL="https://myninebage" KEY="XXXX-XX-XXX-XXX"' > ${HOME}/.badyrc" + exit 2 +fi + +echo `${1}` 2>/dev/null | jq