]> kaliko git repositories - mpd-sima.git/blobdiff - data/bash/completion.sh
Add new command purge-history
[mpd-sima.git] / data / bash / completion.sh
index 1bbb2d7513bb6146a89b6110abb89b1379b97a15..3defa7221b2bc6d696f51640a0c1e6fdc75eb584 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2011, 2013, 2014 Jack Kaliko <kaliko@azylum.org>
+# Copyright (c) 2010, 2011, 2013, 2014, 2015, 2021 kaliko <kaliko@azylum.org>
 #
 #  This file is part of MPD_sima
 #
@@ -31,9 +31,13 @@ _sima() {
           -l --log \
           -v --log-level \
           -S --host \
-          -P --mpd_port \
+          -P --port \
           -h --help --version \
-          --var_dir"
+          --var-dir \
+          -d --daemon \
+          config-test \
+          generate-config \
+          purge-history"
 
     if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
@@ -41,7 +45,7 @@ _sima() {
     fi
 
     case "${prev}" in
-        --var_dir)
+        --var-dir)
             _filedir -d
             ;;
         -v|--log-level)
@@ -52,13 +56,6 @@ _sima() {
             ;;
         -c|--config)
             _filedir
-            if [ -z $XDG_DATA_HOME ]; then
-                local confnames=$(for x in $(ls -1 $HOME/.config/mpd_sima/*.cfg 2>/dev/null) ; do echo "${x##*//}"; done)
-            else
-                local confnames=$(for x in $(ls -1 $HOME/.config/mpd_sima/*.cfg $XDG_DATA_HOME/mpd_sima/*.cfg 2>/dev/null) ; do echo "${x##*//}"; done)
-            fi
-            COMPREPLY+=( $(compgen -W "${confnames}") )
-            return 0
             ;;
         --host|-S)
             COMPREPLY=( $(compgen -A hostname ${cur}) )
@@ -70,23 +67,17 @@ _sima() {
 complete -F _sima mpd_sima
 complete -F _sima mpd-sima
 
-_art_names_list() {
-    local IFS=$'\n'
-    compgen -W "${artists}" -- ${cur}
-}
-
 _simadb_cli() {
-    local cur prev opts artists
+    local cur prev opts
     local IFS=$'\n'
     COMPREPLY=()
     _get_comp_words_by_ref cur prev
-    opts="--add_similarity -a --remove_similarity --remove_artist \
-    --purge_hist --view_artist --view_all \
-    --bl_curr_trk --bl_curr_art --bl_curr_al --bl_art --remove_bl --view_bl \
-    --dbfile -d \
-    --host -S --port -P \
-    --reciprocal -r --check_names -c \
-    --version -h --help"
+    opts="--bl_curr_trk --bl_curr_art --bl_curr_al \
+      --bl_art --remove_bl --view_bl --purge_hist \
+        --dbfile -d \
+        --host -S --port -P \
+        --check_names -c \
+        --version -h --help"
     opts=$(echo $opts | sed 's/ /\n/g')
 
     if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
@@ -104,15 +95,6 @@ _simadb_cli() {
         --host|-S)
             COMPREPLY=( $(compgen -A hostname ${cur}) )
             ;;
-        -a|--add_similarity|--view_artist|-v|--bl_art)
-            if [ -x /usr/bin/mpc ]; then
-                artists=$(for x in $(/usr/bin/mpc list artist) ; do echo "'${x}'"; done)
-                COMPREPLY=( $(compgen -W "${artists}" -- ${cur}) )
-                return 0
-            fi
-            # It should also complete artist name when the string ends with a comma
-            return 0
-            ;;
         *)
             ;;
     esac