pld-ftp-admin: shell/bash-completion.sh - updated, added lintpkg completion

glen glen at pld-linux.org
Thu Jun 9 21:14:41 CEST 2011


Author: glen                         Date: Thu Jun  9 19:14:41 2011 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
- updated, added lintpkg completion

---- Files affected:
pld-ftp-admin/shell:
   bash-completion.sh (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: pld-ftp-admin/shell/bash-completion.sh
diff -u pld-ftp-admin/shell/bash-completion.sh:1.5 pld-ftp-admin/shell/bash-completion.sh:1.6
--- pld-ftp-admin/shell/bash-completion.sh:1.5	Sat Apr 16 19:02:12 2011
+++ pld-ftp-admin/shell/bash-completion.sh	Thu Jun  9 21:14:36 2011
@@ -1,10 +1,6 @@
 # various completions for pld-ftp-admin tools
 # Author: Elan Ruusamäe <glen at pld-linux.org>
 
-have pfa-genindex || return
-have pfa-lintpkg || return
-have pfa-mvpkg || return
-
 # return list of pld ftp trees
 _pfa_tree() {
     local cur="$1"
@@ -37,6 +33,7 @@
     done
 }
 
+have pfa-genindex &&
 _pfa-genindex()
 {
     local cur
@@ -57,8 +54,33 @@
 } &&
 complete -F _pfa-genindex pfa-genindex
 
+have pfa-lintpkg &&
 _pfa-lintpkg()
 {
+    local cur arg
+
+    COMPREPLY=()
+    _get_comp_words_by_ref cur
+
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $( compgen -W '-q -s --quiet' -- "$cur" ) )
+    else
+        # The first argument is an tree; the rest are files in a dir
+        _count_args :
+
+        if [[ $args == 1 ]]; then
+            _pfa_tree "$cur"
+        else
+            _get_first_arg
+            _pfa_tree_files "$arg" "$cur"
+        fi
+    fi
+} &&
+complete -F _pfa-lintpkg pfa-lintpkg
+
+have pfa-signpkg &&
+_pfa-signpkg()
+{
     local cur
 
     COMPREPLY=()
@@ -73,8 +95,9 @@
         _pfa_tree_files "${COMP_WORDS[1]}" "$cur"
     fi
 } &&
-complete -F _pfa-lintpkg pfa-lintpkg pfa-signpkg pfa-rmpkg
+complete -F _pfa-signpkg pfa-signpkg pfa-rmpkg
 
+have pfa-mvpkg &&
 _pfa-mvpkg()
 {
     local cur
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-ftp-admin/shell/bash-completion.sh?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list