From 0eb3fd6b3f25e6fd0f22ed4327b2aa1b019cde18 Mon Sep 17 00:00:00 2001 From: Josef Gajdusek Date: Mon, 28 Mar 2016 00:39:15 +0200 Subject: [PATCH] Make modprobe completion more precise Only match loaded modules when -r is specified. Also adds /lib/modules/(uname -r)/misc to the search path. This directory is used by Gentoo for package-provided modules (such as the app-emulation/virtualbox-modules) --- share/completions/modprobe.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/completions/modprobe.fish b/share/completions/modprobe.fish index 14133ad55..8075d4373 100644 --- a/share/completions/modprobe.fish +++ b/share/completions/modprobe.fish @@ -2,7 +2,8 @@ # Completions for the modprobe command # -complete -c modprobe --no-files -d Module -a "(find /lib/modules/(uname -r)/kernel -type f | sed -e 's/\/.*\/\([^\/.]*\).*/\1/')" +complete -c modprobe -n "__fish_contains_opt -s r remove" --no-files -d Module -a "(lsmod | cut -d' ' -f1)" +complete -c modprobe -n "not __fish_contains_opt -s r remove" --no-files -d Module -a "(find /lib/modules/(uname -r)/{kernel,misc} -type f 2>/dev/null | sed -e 's/\/.*\/\([^\/.]*\).*/\1/')" complete -c modprobe -s v -l verbose --description "Print messages about what the program is doing" complete -c modprobe -s C -l config --description "Configuration file" -r complete -c modprobe -s c -l showconfig --description "Dump configuration file"