aboutsummaryrefslogtreecommitdiffstats
path: root/completions/rsp.zsh
blob: cfba4e5db30744141d70a97e8097ee07e028cbc8 (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
#compdef rsp

_rsp() {
  _arguments -C \
    '1:command:->cmd' \
    '*::args:->args'

  case $state in
    cmd)
      _values 'command' \
        'start' 'stop' 'restart' 'play' 'pause' 'resume' 'toggle' 'next' 'previous' \
        'volume' 'shuffle' 'queue' 'status' 'scan' 'settings'
      ;;
    args)
      # if first word is "play", complete files/dirs
      if [[ $words[1] == play || $words[2] == play ]]; then
        _files
      else
        # default: complete nothing (or you can list other subcommand args)
        return 0
      fi
      ;;
  esac
}

compdef _rsp rsp