First commit

This commit is contained in:
Philippe Caseiro 2022-03-22 13:57:47 +01:00
parent 675347dbed
commit 73fef605a5
2 changed files with 45 additions and 1 deletions

View File

@ -1,3 +1,7 @@
# badgy
Very simple ninebadge shell client
Very simple ninebadge shell client
# Depends
This works with "curlie" (https://curlie.io)

40
badgy Executable file
View File

@ -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