aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/completions/zsh/_keyringer
blob: 1f1c25005c61fc329346a342ffa13d188156175d (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
#compdef keyringer

_keyringer() {
    local curcontext="$curcontext" state line
    typeset -A opt_args

    # Initial options
    local config="$HOME/.keyringer"
    local keyrings="`ls $config | sed -e 's/config//'`"

    _arguments \
      '1: :->keyring'\
      '2: :->action'\
      '*: :->options'

    case $state in
      keyring)
        _arguments "1:Keyrings:($keyrings)"
        ;;
      action)
        compadd "$@" `keyringer $words[2] commands`
        ;;
      *)
        # TODO
        true
        ;;
    esac 
}

_keyringer "$@"