[PATCH 2/3] shell-completion: Add kmod static-nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>

---
 shell-completion/bash/kmod | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/shell-completion/bash/kmod b/shell-completion/bash/kmod
index 81dbf46..2409eda 100644
--- a/shell-completion/bash/kmod
+++ b/shell-completion/bash/kmod
@@ -24,6 +24,28 @@ __contains_word () {
     return 1
 }
 
+_kmod_static_nodes () {
+    local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+    local opts='-o --output -f --format -h --help'
+
+    echo "cur='$cur' prev='$prev'" >> /tmp/a.txt
+    case $prev in
+	'-o' | '--output')
+	    compopt -o filenames
+	    COMPREPLY=( $(compgen -f -- "$cur") )
+	    ;;
+	'-f' | '--format')
+	    COMPREPLY=( $(compgen -W 'human tmpfiles devname' -- "$cur") )
+	    ;;
+	'-'*)
+	    COMPREPLY=()
+	    ;;
+	*)
+	    COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
+	    ;;
+    esac
+}
+
 _kmod() {
     local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
     local verb comps
@@ -44,6 +66,11 @@ _kmod() {
 
     if [[ -z $verb ]]; then
 	comps=${VERBS[*]}
+    elif __contains_word "$verb" ${VERBS[STATIC-NODES]}; then
+	_kmod_static_nodes
+	return 0
+    else
+	comps=''
     fi
 
     COMPREPLY=( $(compgen -W '$comps' -- "$cur" ) )
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux