#!/usr/bin/env sh

ID=$(task export | jq -r 'sort_by( -.urgency )[] | [ (.id|tostring), .description ] | join("	")' | awk '!$1=="0"' |
  rofi -no-auto-select -theme ~/.config/rofi/configTall.rasi -i -dmenu -p "" |
  cut -f 1)
[ -z "$ID" ] && echo "Cancelled." && exit

ACTION=$(printf "add\nstart\nstop\nedit\ndone" | rofi -config ~/.config/rofi/configTall.rasi -no-auto-select -i -dmenu -p "Action")
[ -z "$ACTION" ] && echo "Cancelled." && exit

task "$ID" "$ACTION"
