let faxreport guess id

This commit is contained in:
Gandalf 2021-03-14 11:51:12 +01:00
parent 559a3a2a4a
commit 02779f34f7
2 changed files with 9 additions and 3 deletions

View file

@ -16,7 +16,7 @@ Spaces in filename seem to make trouble at the moment - avoid them.
`balance.sh` just gives your account balance.
`faxreport.sh [options] [id]` loads the report of a given fax id (as shown by status.sh)
`faxreport.sh [options] [id]` loads the report of a given fax id (as shown by status.sh). If no `id` ist given, it takes the last sent fax from this machine.
: Options are not implemented yet, but those are gonna be accepted:
* `-p` to only print and not save the report
* `-d` to delete the given id from `.fax_history`

View file

@ -27,7 +27,13 @@ done
if [ $IDF = false ]
then
echo "Guessing…"
exit 0 # Nur, damit es nix durcheinanderbringt, bis die guess-Arithmetik implementiert ist
$ID=$(tail -n 1 $BASEPATH/.fax_history)
if [ -z $ID ]
then
echo "Nothing to guess from. Please send a fax first"
exit 1
fi
$IDF=true
fi
. $BASEPATH/authorization.sh # stellt AUTH_TOKEN bereit
@ -36,7 +42,7 @@ JSON=$(curl -X GET -H "accept: application/json" -H "Authorization: Bearer $AUT
DATE=$(echo $JSON | jq '.created' | sed -e 's:"::g' )
if [ -z $DATE ]
then
echo "Fax seems to not exist. "
echo "Fax seems to not exist with this account."
exit 1
fi
DATE=$(date -d $DATE +%Y%m%d%H%M)