aboutsummaryrefslogtreecommitdiff
path: root/completions/bash/sway
blob: 01b20073ff603a9c32bc35c048482f137af523ed (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# sway(1) completion

_sway()
{
  local cur prev short long
  _get_comp_words_by_ref cur prev

  short=(
    -h
    -c
    -C
    -d
    -v
    -V
  )

  long=(
    --help
    --config
    --validate
    --debug
    --version
    --verbose
    --get-socketpath
  )

  case $prev in
    -c|--config)
      _filedir
      return
      ;;
  esac

  if [[ $cur == --* ]]; then
    COMPREPLY=($(compgen -W "${long[*]}" -- "$cur"))
  elif [[ $cur == -* ]]; then
    COMPREPLY=($(compgen -W "${short[*]}" -- "$cur"))
    COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur"))
  else
    COMPREPLY=($(compgen -W "${short[*]}" -- "$cur"))
    COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur"))
    COMPREPLY+=($(compgen -c -- "$cur"))
  fi

} &&
complete -F _sway sway