aboutsummaryrefslogtreecommitdiff
path: root/zsh/functions/_boom
blob: 74e5d4e41bab74f29dcef69c42ec269713917318 (plain) (blame)
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
#compdef boom

local state line cmds ret=1

_arguments -C '1: :->cmds' '*: :->args'

case $state in
  cmds)
    local -a cmds
    cmds=(
      'all:show all items in all lists'
      'edit:edit the boom JSON file in $EDITOR'
      'help:help text'
    )
    _describe -t commands 'boom command' cmds && ret=0
    _values 'lists' $(boom | awk '{print $1}')
    ;;
  args)
    case $line[1] in
      (boom|all|edit|help)
        ;;
      *)
        _values 'items' `boom $line[1] | awk '{print $1}' | sed -e 's/://'` 2>/dev/null && ret=0
        ;;
    esac
    ;;
esac

return ret