]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-bash-completion.sh: add positional argument completion
authorGaël PORTAY <gael.portay@collabora.com>
Tue, 14 Jul 2020 15:29:53 +0000 (11:29 -0400)
committerDaniel Molkentin <daniel@molkentin.de>
Sun, 15 Nov 2020 23:00:04 +0000 (00:00 +0100)
dracut-bash-completion.sh

index 17374bf3e0f40f057e19a3bed745374d98221b40..913471017956b47d2561ee88b70de6715f5aa0f2 100644 (file)
@@ -73,6 +73,17 @@ _dracut() {
                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
                 return 0
         fi
+
+        local args
+        _count_args
+        if [[ $args -eq 1 ]]; then
+                _filedir
+                return 0
+        elif [[ $args -eq 2 ]]; then
+                comps=$(cd /lib/modules; echo [0-9]*)
+                COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+                return 0
+        fi
 }
 
 complete -F _dracut dracut