Skip to content

Commit

Permalink
feat: implement makoctl count with variants
Browse files Browse the repository at this point in the history
  • Loading branch information
fidelicura committed Aug 4, 2024
1 parent 4d48aca commit 226660f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions makoctl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ usage() {
echo "Usage: makoctl <command> [options...]"
echo ""
echo "Commands:"
echo " count [waiting|history] Show the number of notifications"
echo " dismiss [-n id] Dismiss the notification with the"
echo " given id, or the last notification"
echo " if none is given"
Expand Down Expand Up @@ -56,6 +57,24 @@ if [ $# -eq 0 ]; then
fi

case "$1" in
"count")
require_jq
if [ $# -gt 1 ]; then
case "$2" in
waiting)
call ListNotifications | jq -re '.data[0] | length'
;;
history)
call ListHistory | jq -re '.data[0] | length'
;;
*)
echo >&2 "$0: Expected 'waiting' or 'history' after 'count', got '$2'"
;;
esac
else
echo >&2 "$0: Expected 'waiting' or 'history' after 'count', got nothing"
fi
;;
"dismiss")
all=0
group=0
Expand Down

0 comments on commit 226660f

Please sign in to comment.