[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-95-gd08b9f2

Ville Skyttä ville.skytta at iki.fi
Tue Jan 29 21:29:14 UTC 2013


The following commit has been merged in the master branch:
commit d08b9f233559b3dced20050ba312b08fe0de53b4
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Jan 29 23:28:13 2013 +0200

    modprobe: Don't suggest installing already installed modules.

diff --git a/completions/modprobe b/completions/modprobe
index cf35f4b..b59e4dc 100644
--- a/completions/modprobe
+++ b/completions/modprobe
@@ -77,6 +77,20 @@ _modprobe()
                     -p "$module" 2>/dev/null | cut -d: -f1 )" -- "$cur" ) )
             else
                 _modules $version
+                if [[ $COMPREPLY ]]; then
+                    # filter out already installed modules
+                    local -a mods=( "${COMPREPLY[@]}" )
+                    _installed_modules "$cur"
+                    for i in ${!mods[@]}; do
+                        for module in ${COMPREPLY[@]}; do
+                            if [[ ${mods[i]} == $module ]]; then
+                                unset mods[i]
+                                break
+                            fi
+                        done
+                    done
+                    COMPREPLY=( "${mods[@]}" )
+                fi
             fi
             ;;
     esac

-- 
bash-completion



More information about the Bash-completion-commits mailing list