summaryrefslogtreecommitdiff
path: root/completion/tessen.bash-completion
blob: 5d61749d770333d984bff7a143e740a651d52395 (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
_tessen() {
  local cur prev
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"
  prev="${COMP_WORDS[COMP_CWORD - 1]}"
  all_long_opts="--pass --dmenu --action --help --version "
  all_short_opts="-p -d -a -h -v "
  case "$prev" in
    --pass | -p | --dmenu | -d | --action | -a)
      mapfile -t COMPREPLY < <(compgen -o bashdefault -o default -- "${cur}")
      return 0
      ;;
    *)
      case "$cur" in
        --*)
          mapfile -t COMPREPLY < <(compgen -W "${all_long_opts}" -- "${cur}")
          return 0
          ;;
        -*)
          mapfile -t COMPREPLY < <(compgen -W "${all_short_opts}" -- "${cur}")
          return 0
          ;;
        *)
          mapfile -t COMPREPLY < <(compgen -o bashdefault -o default -- "${cur}")
          return 0
          ;;
      esac
      ;;
  esac
}
complete -F _tessen tessen