ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / debian / koha-common.bash-completion
index d65aba2..b40ae47 100644 (file)
@@ -98,20 +98,12 @@ _koha_sip_enabled_instances()
     return 0
 }
 
-# koha-*-sip autocomplete with sip-enabled instances
-complete -F _koha_sip_enabled_instances koha-start-sip
-complete -F _koha_sip_enabled_instances koha-restart-sip
-complete -F _koha_sip_enabled_instances koha-stop-sip
-
 _koha_sip_disabled()
 {
     _koha_list_cmd "--nosip"
     return 0
 }
 
-# koha-enable-sip autocompletes with sip-disabled instances
-complete -F _koha_sip_disabled koha-enable-sip
-
 _koha_disabled_instances()
 {
     _koha_list_cmd "--disabled"
@@ -130,11 +122,6 @@ complete -F _koha_disabled_instances koha-enable
 # koha-disable autocompletes with enabled instances
 complete -F _koha_enabled_instances koha-disable
 
-# koha-*-zebra autocomplete with enabled instances
-complete -F _koha_enabled_instances koha-start-zebra
-complete -F _koha_enabled_instances koha-restart-zebra
-complete -F _koha_enabled_instances koha-stop-zebra
-
 # koha-mysql autocompletes with a single instance name
 complete -F _koha_single_instance koha-mysql
 
@@ -217,9 +204,9 @@ _koha-plack()
                  --help) COMPREPLY=() ; return 0 ;; # no more completions
                      -h) COMPREPLY=() ; return 0 ;; # no more completions
                 --quiet) # filter the other quiet switches and go on
-                    substract="$substract -e '--quiet' -e '-q'"; ;;
+                    substract="$substract -e -q"; ;;
                 -q)      # filter the other quiet switches and go on
-                    substract="$substract -e '--quiet' -e '-q'"; ;;
+                    substract="$substract -e --quiet"; ;;
             esac
             substract="$substract -e ${COMP_WORDS[i]}"
         fi
@@ -235,6 +222,117 @@ _koha-plack()
 }
 complete -F _koha-plack koha-plack
 
+_koha-indexer()
+{
+    local cur opts substract
+
+    COMPREPLY=()
+    _get_comp_words_by_ref cur
+    opts="--start --stop --restart --quiet -q --help -h"
+
+    # Build a list of the already used option switches
+    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+        if [[ ${COMP_WORDS[i]} == -* ]]; then
+            case ${COMP_WORDS[i]} in
+                --start) _koha_list_cmd ; return 0 ;;
+                 --stop) _koha_list_cmd ; return 0 ;;
+              --restart) _koha_list_cmd ; return 0 ;;
+                 --help) COMPREPLY=() ; return 0 ;; # no more completions
+                     -h) COMPREPLY=() ; return 0 ;; # no more completions
+                --quiet) # filter the other quiet switches and go on
+                    substract="$substract -e -q"; ;;
+                -q)      # filter the other quiet switches and go on
+                    substract="$substract -e --quiet"; ;;
+            esac
+            substract="$substract -e ${COMP_WORDS[i]}"
+        fi
+    done
+
+    if [[ "$substract" != "" ]]; then
+        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
+    fi
+
+    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
+
+    return 0
+}
+complete -F _koha-indexer koha-indexer
+
+_koha-zebra()
+{
+    local cur opts substract
+
+    COMPREPLY=()
+    _get_comp_words_by_ref cur
+    opts="--start --stop --restart --status --quiet -q --help -h"
+
+    # Build a list of the already used option switches
+    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+        if [[ ${COMP_WORDS[i]} == -* ]]; then
+            case ${COMP_WORDS[i]} in
+                --start) _koha_list_cmd ; return 0 ;;
+                 --stop) _koha_list_cmd ; return 0 ;;
+              --restart) _koha_list_cmd ; return 0 ;;
+               --status) _koha_list_cmd ; return 0 ;;
+                 --help) COMPREPLY=() ; return 0 ;; # no more completions
+                     -h) COMPREPLY=() ; return 0 ;; # no more completions
+                --quiet) # filter the other quiet switches and go on
+                    substract="$substract -e -q"; ;;
+                -q)      # filter the other quiet switches and go on
+                    substract="$substract -e --quiet"; ;;
+            esac
+            substract="$substract -e ${COMP_WORDS[i]}"
+        fi
+    done
+
+    if [[ "$substract" != "" ]]; then
+        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
+    fi
+
+    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
+
+    return 0
+}
+complete -F _koha-zebra koha-zebra
+
+_koha-sip()
+{
+    local cur opts substract
+
+    COMPREPLY=()
+    _get_comp_words_by_ref cur
+    opts="--start --stop --restart --status --enable --verbose -v --help -h"
+
+    # Build a list of the already used option switches
+    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+        if [[ ${COMP_WORDS[i]} == -* ]]; then
+            case ${COMP_WORDS[i]} in
+                --start) _koha_sip_enabled_instances ; return 0 ;;
+                 --stop) _koha_sip_enabled_instances ; return 0 ;;
+              --restart) _koha_sip_enabled_instances ; return 0 ;;
+               --status) _koha_sip_enabled_instances ; return 0 ;;
+               --enable) _koha_sip_disabled ; return 0 ;;
+                 --help) COMPREPLY=() ; return 0 ;; # no more completions
+                     -h) COMPREPLY=() ; return 0 ;; # no more completions
+              --verbose) # filter the other quiet switches and go on
+                    substract="$substract -e -q"; ;;
+                -v)      # filter the other quiet switches and go on
+                    substract="$substract -e --verbose"; ;;
+            esac
+            substract="$substract -e ${COMP_WORDS[i]}"
+        fi
+    done
+
+    if [[ "$substract" != "" ]]; then
+        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
+    fi
+
+    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
+
+    return 0
+}
+complete -F _koha-sip koha-sip
+
 # Local variables:
 # mode: shell-script
 # sh-basic-offset: 4