Author: Adam <git@apiote.xyz>
add custom date to drunk
.local/bin/drank | 7 ++++++-
diff --git a/.local/bin/drank b/.local/bin/drank index f8d4e28a2039ca88f9d30a2e13e717e3a6b7bfb5..8d73776ddb0395c0d8651fd3395edd981c700731 100755 --- a/.local/bin/drank +++ b/.local/bin/drank @@ -47,7 +47,12 @@ sqlite3 "$HOME/.local/state/water/water.db" "insert into intakes values('$date', '$time', $amount, '$2', '$meID')" 2>/dev/null echo "ok, drank ${amount} ml $2" ;; drunk) - today=$(date '+%Y%m%d') + if [ -z "$1" ] + then + today=$(date '+%Y%m%d') + else + today="$1" + fi sqlite3 "$HOME/.local/state/water/water.db" -noheader "select amount, drink, time from devices join intakes using(device_id) where device_type = 'me' and date = '$today'" 2>/dev/null ;; esac