]> kaliko git repositories - mpd-sima.git/blob - data/bash/completion.sh
Add new command purge-history
[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           generate-config \
40           purge-history"
41
42     if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
43         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
44         return 0
45     fi
46
47     case "${prev}" in
48         --var-dir)
49             _filedir -d
50             ;;
51         -v|--log-level)
52             COMPREPLY=( $(compgen -W "debug info warning error" -- ${cur} ))
53             ;;
54         -p|--pid|-l|--log)
55             _filedir
56             ;;
57         -c|--config)
58             _filedir
59             ;;
60         --host|-S)
61             COMPREPLY=( $(compgen -A hostname ${cur}) )
62             ;;
63         *)
64             ;;
65     esac
66 }
67 complete -F _sima mpd_sima
68 complete -F _sima mpd-sima
69
70 _simadb_cli() {
71     local cur prev opts
72     local IFS=$'\n'
73     COMPREPLY=()
74     _get_comp_words_by_ref cur prev
75     opts="--bl_curr_trk --bl_curr_art --bl_curr_al \
76       --bl_art --remove_bl --view_bl --purge_hist \
77         --dbfile -d \
78         --host -S --port -P \
79         --check_names -c \
80         --version -h --help"
81     opts=$(echo $opts | sed 's/ /\n/g')
82
83     if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
84         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
85         return 0
86     fi
87
88     case "${prev}" in
89         --bl_curr*|--view_bl|--view_all|--purge_hist|--version|--help|-h)
90             return 0
91             ;;
92         -d|--dbfile)
93             _filedir
94             ;;
95         --host|-S)
96             COMPREPLY=( $(compgen -A hostname ${cur}) )
97             ;;
98         *)
99             ;;
100     esac
101 }
102 complete -F _simadb_cli simadb_cli