]> kaliko git repositories - mpd-sima.git/blob - data/bash/completion.sh
a05274088d7a4f36f7d64d43318f468d1bf06309
[mpd-sima.git] / data / bash / completion.sh
1 # Copyright (c) 2010, 2011, 2013, 2014, 2015, 2021 kaliko <kaliko@azylum.org>
2 #
3 #  This file is part of MPD_sima
4 #
5 #  MPD_sima is free software: you can redistribute it and/or modify
6 #  it under the terms of the GNU General Public License as published by
7 #  the Free Software Foundation, either version 3 of the License, or
8 #  (at your option) any later version.
9 #
10 #  MPD_sima is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #  GNU General Public License for more details.
14 #
15 #  You should have received a copy of the GNU General Public License
16 #  along with MPD_sima.  If not, see <http://www.gnu.org/licenses/>.
17 #
18 #
19
20 # Bash completion file
21 #
22 # On debian system either place this file in etc/bash_completion.d/ or source it
23 # in your barshrc.
24
25 _sima() {
26     local cur prev opts
27     COMPREPLY=()
28     _get_comp_words_by_ref cur prev
29     opts="-c --config \
30           -p --pid \
31           -l --log \
32           -v --log-level \
33           -S --host \
34           -P --port \
35           -h --help --version \
36           --var-dir \
37           -d --daemon \
38           config-test \
39           create-db \
40           generate-config \
41           purge-history \
42           bl-view \
43           bl-add-artist \
44           bl-add-album \
45           bl-add-track \
46           bl-delete"
47
48     if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
49         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
50         return 0
51     fi
52
53     case "${prev}" in
54         --var-dir)
55             _filedir -d
56             ;;
57         -v|--log-level)
58             COMPREPLY=( $(compgen -W "debug info warning error" -- ${cur} ))
59             ;;
60         -p|--pid|-l|--log|-c|--config)
61             _filedir
62             ;;
63         --host|-S)
64             _known_hosts_real -a "${cur}"
65             ;;
66         *)
67             COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
68             ;;
69     esac
70 }
71 complete -o nosort -F _sima mpd_sima
72 complete -o nosort -F _sima mpd-sima