View | Details | Raw Unified | Return to bug 13791
Collapse All | Expand All

(-)a/debian/koha-common.bash-completion (-3 / +57 lines)
Lines 56-65 _koha_list_cmd() Link Here
56
    if [[ "$substract" != "" ]]; then
56
    if [[ "$substract" != "" ]]; then
57
        instancelist=$( koha-list $filter | grep -v -x $substract )
57
        instancelist=$( koha-list $filter | grep -v -x $substract )
58
    else
58
    else
59
        instancelist=$( koha-list $filer )
59
        instancelist=$( koha-list $filter )
60
    fi
60
    fi
61
61
62
    COMPREPLY=( $(compgen -W "$instancelist" -- $cur ) )
62
    COMPREPLY=( $(compgen -W "$instancelist" -- $cur ) )
63
    return 0
63
}
64
}
64
65
65
_koha_email_disable()
66
_koha_email_disable()
Lines 125-131 _koha_list() Link Here
125
126
126
    COMPREPLY=()
127
    COMPREPLY=()
127
    _get_comp_words_by_ref cur
128
    _get_comp_words_by_ref cur
128
    opts="--enabled --disabled --email --noemail --sip --nosip --help -h"
129
    opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h"
129
130
130
    # Build a list of the already used option switches
131
    # Build a list of the already used option switches
131
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
132
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
Lines 139-144 _koha_list() Link Here
139
                    substract="$substract -e --noemail"; ;;
140
                    substract="$substract -e --noemail"; ;;
140
                --noemail)
141
                --noemail)
141
                    substract="$substract -e --email"; ;;
142
                    substract="$substract -e --email"; ;;
143
                --plack)
144
                    substract="$substract -e --noplack"; ;;
145
                --noplack)
146
                    substract="$substract -e --plack"; ;;
142
                --sip)
147
                --sip)
143
                    substract="$substract -e --nosip"; ;;
148
                    substract="$substract -e --nosip"; ;;
144
                --nosip)
149
                --nosip)
Lines 162-167 _koha_list() Link Here
162
}
167
}
163
complete -F _koha_list koha-list
168
complete -F _koha_list koha-list
164
169
170
_koha_plack_instances()
171
{
172
    _koha_list_cmd "--plack"
173
    return 0
174
}
175
176
_koha_noplack_instances()
177
{
178
    _koha_list_cmd "--noplack"
179
    return 0
180
}
181
182
_koha-plack()
183
{
184
    local cur opts substract
185
186
    COMPREPLY=()
187
    _get_comp_words_by_ref cur
188
    opts="--start --stop --restart --enable --disable --quiet -q --help -h"
189
190
    # Build a list of the already used option switches
191
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
192
        if [[ ${COMP_WORDS[i]} == -* ]]; then
193
            case ${COMP_WORDS[i]} in
194
                --start) _koha_plack_instances ; return 0 ;;
195
                 --stop) _koha_plack_instances ; return 0 ;;
196
              --restart) _koha_plack_instances ; return 0 ;;
197
               --enable) _koha_noplack_instances ; return 0 ;;
198
              --disable) _koha_plack_instances ; return 0 ;;
199
                 --help) COMPREPLY=() ; return 0 ;; # no more completions
200
                     -h) COMPREPLY=() ; return 0 ;; # no more completions
201
                --quiet) # filter the other quiet switches and go on
202
                    substract="$substract -e '--quiet' -e '-q'"; ;;
203
                -q)      # filter the other quiet switches and go on
204
                    substract="$substract -e '--quiet' -e '-q'"; ;;
205
            esac
206
            substract="$substract -e ${COMP_WORDS[i]}"
207
        fi
208
    done
209
210
    if [[ "$substract" != "" ]]; then
211
        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
212
    fi
213
214
    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
215
216
    return 0
217
}
218
complete -F _koha-plack koha-plack
219
165
# Local variables:
220
# Local variables:
166
# mode: shell-script
221
# mode: shell-script
167
# sh-basic-offset: 4
222
# sh-basic-offset: 4
168
- 

Return to bug 13791