Debian Codegraph @

main/praat.bash-completion

raw
1 # -*- shell-script -*-
2 # Bash command completion for ‘praat(1)’.
3 #
4 # Copyright (C) 2025, 2026 Rafael Laboissière
5 #
6 # This script is free software: you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the
8 # Free Software Foundation, either version 3 of the License, or (at your
9 # option) any later version.
10 #
11 # This script is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 # Public License for more details.
15 #
16 # See <https://www.gnu.org/licenses/>.
17
18 shopt -s progcomp
19
20 _praat_completion () {
21 COMPREPLY=()
22
23 local cur="${COMP_WORDS[COMP_CWORD]}"
24 local prev="${COMP_WORDS[COMP_CWORD-1]}"
25
26 local opts="--help --version"
27 opts+=" --run --open --new-open --send --new-send --send-or-form"
28 opts+=" --FULL-TRUST --no-pref-files --no-plugins --pref-dir -u --utf16"
29 opts+=" -8 --utf8 -a --ansi --trace --hide-picture --debug"
30
31 case "${prev}" in
32 --run|--open|--new-open|--send|--new-send|--send-or-form)
33 COMPREPLY=( $(compgen -A file -- ${cur}) )
34 ;;
35 --pref-dir)
36 COMPREPLY=( $(compgen -A directory -- ${cur}) )
37 ;;
38 *)
39 COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
40 ;;
41 esac
42 }
43
44 complete -F _praat_completion praat