aboutsummaryrefslogtreecommitdiff
path: root/scripts/.scripts/tdone
blob: d63fd8720e4eac03fa4799f13ad7e5edef1a9a0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

usage () {
  echo "Usage:"
  echo "      tdone <option> <date>"
  echo "Date list:"
  echo "      today       - Show the tasks done today"
  echo "      yesterday   - Show the tasks done yesterday"
  echo "      week        - Show the tasks done this week"
  echo "      month       - Show the tasks done this month"
  echo "Option list:"
  echo "      -h view this help message"
  }

if [[ $1 == "today" ]]; then
  task end.after:today completed
elif [[ $1 == "yesterday" ]]; then
  task end.after:today-1d completed
elif [[ $1 == "month" ]]; then
  task end.after:socm completed
elif [[ $1 == "week" ]]; then
  task end.after:socw completed
elif [[ $@ =~ ^[[:digit:][:space:]]*$  ]]; then
  task modify -next $@; task done $@
elif [[ $1 == "-h" ]]; then
  usage
else
  echo "Wrong option/date"
  echo "Write 'tdone -h' for help"
fi