[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-235-g26ae770

Igor Murzov igor at gplsoft.org
Mon May 2 10:26:54 UTC 2011


The following commit has been merged in the master branch:
commit cbcc031e2e0ea6dc7ec2dbdd00774b9a8a9e3f76
Author: Igor Murzov <igor at gplsoft.org>
Date:   Mon May 24 00:08:57 2010 +0400

    Add pkgtool(8) completion

diff --git a/contrib/pkgtools b/contrib/pkgtools
index 85e5d99..229c74d 100644
--- a/contrib/pkgtools
+++ b/contrib/pkgtools
@@ -1,5 +1,47 @@
 # bash completion for Slackware Linux pkgtools
 
+have pkgtool && [ -f /etc/slackware-version ] &&
+_pkgtool()
+{
+    COMPREPLY=()
+    local cur="${COMP_WORDS[COMP_CWORD]}"
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $( compgen -W '--sets --ignore_tagfiles --tagfile \
+            --source_mounted --source_dir --target_dir --source_device' \
+            -- "$cur" ) )
+        return 0
+    fi
+
+    local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+    local split=false
+    _split_longopt && split=true
+        
+    case $prev in
+        --source_dir|--target_dir)
+            _filedir -d
+            return 0
+            ;;
+        --sets)
+            # argument required but no completions available
+            return 0
+            ;;
+        --source_device)
+            COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) )
+            return 0
+            ;;
+    esac
+    
+    $split && return 0
+    
+    _expand || return 0
+    
+    local IFS=$'\t\n'
+    COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+        $( compgen -d -- "$cur" ) )
+} &&
+complete -F _pkgtool -o filenames pkgtool
+
 have removepkg && [ -f /etc/slackware-version ] &&
 _removepkg()
 {

-- 
bash-completion



More information about the Bash-completion-commits mailing list