~tardypad/dotfiles

ref: 33ca1a08ea73fb304e13ef9be088366f13883456 dotfiles/files/configs/zsh/functions/time-tracker-overview -rw-r--r-- 686 bytes
33ca1a08 — Damien Tardy-Panis Set systemd timers for cache service to run daily 3 months ago
                                                                                
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
31
# commands used:
# - column
# - task
# - time-tracker

# add task name in time-tracker overview display

local day="$1"

[ -n "${day}" ] || day="$( date +%Y-%m-%d )"

local line tasks task_id duration desc

tasks="$( task -n ids )"

time-tracker -d "${day}" -t overview \
  | while read -r line; do
      task_id="$( echo "${line}" | cut -f1 )"
      duration="$( echo "${line}" | cut -f2 )"
      desc="$( echo "${line}" | cut -f3 )"

      task_name="$(
        echo "${tasks}" \
          | sed -n "s/^${task_id}	\(.*\)/\1/p" \
          | sed 1q
      )"

      printf '%s\t%s\t%s\t%s\n' \
        "${task_id}" "${duration}" "${desc}" "${task_name}"
    done \
  | column -s '	' -t