Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement makoctl count script command with variants #526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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