~tardypad/dotfiles

ref: f37f64d54c959fb7ec9796c00b8a3f7d4bbbd08c dotfiles/files/configs/zsh/completions/_time-tracker -rw-r--r-- 543 bytes
f37f64d5 — Damien Tardy-Panis Only show task name if -n option is set 4 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
32
33
#compdef time-tracker

local logging_dir="${XDG_DATA_HOME:-$HOME/.local/share}/time-tracker/logs"

_actions() {
  local actions=(
    edit
    log
    overview
    show
    start
    stop
  )

  compadd "$@" $actions
}

_days() {
  _path_files -W "${logging_dir}"
}

_operands() {
  if [ $words[CURRENT-1] = 'overview' ] \
    || [ $words[CURRENT-1] = 'edit' ]; then
    _days
  fi
}

_arguments \
  '-g[display logs grouped by identifier]' \
  '-t[display logs with values separated by tab]' \
  '1:action:_actions' \
  '2:operand:_operands'