forgot to add bash completion script
authorDavid Zeuthen <davidz@redhat.com>
Mon, 17 Mar 2008 21:24:53 +0000 (17:24 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 17 Mar 2008 21:24:53 +0000 (17:24 -0400)
tools/devkit-disks-bash-completion.sh [new file with mode: 0644]

diff --git a/tools/devkit-disks-bash-completion.sh b/tools/devkit-disks-bash-completion.sh
new file mode 100644 (file)
index 0000000..4112f65
--- /dev/null
@@ -0,0 +1,28 @@
+
+# Check for bash
+[ -z "$BASH_VERSION" ] && return
+
+####################################################################################################
+
+__devkit_disks() {
+    local IFS=$'\n'
+    local cur="${COMP_WORDS[COMP_CWORD]}"
+
+    if [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--show-info" ] ; then
+        COMPREPLY=($(compgen -W "$(devkit-disks --enumerate)" -- $cur))
+    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--mount" ] ; then
+        COMPREPLY=($(compgen -W "$(devkit-disks --enumerate)" -- $cur))
+    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--unmount" ] ; then
+        COMPREPLY=($(compgen -W "$(devkit-disks --enumerate)" -- $cur))
+    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--erase" ] ; then
+        COMPREPLY=($(compgen -W "$(devkit-disks --enumerate)" -- $cur))
+    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--create-fs" ] ; then
+        COMPREPLY=($(compgen -W "$(devkit-disks --enumerate)" -- $cur))
+    else
+        COMPREPLY=($(IFS=: compgen -S' ' -W "--inhibit:--enumerate:--monitor:--monitor-detail:--show-info:--help:--mount:--mount-fstype:--mount-options:--unmount:--unmount-options:--erase:--erase-options:--create-fs:--create-fs-type:--create-fs-options" -- $cur))
+    fi
+}
+
+####################################################################################################
+
+complete -o nospace -F __devkit_disks devkit-disks