summaryrefslogtreecommitdiff
path: root/completion/tessen.bash-completion
blob: 81344170fd549d7faa7fb15c1118fa5373982b77 (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="--backend --action --help --version "
  all_short_opts="-b -a -h -v "
  case "$prev" in
    --backend | -b | --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