While reviewing a leftover completion in mageia postfix package, I found
we already have a postconf completion in completions/postconf. However,
I think its content is uselessly complex, and could be simplified with
the attached patch. Unless I missed something, of course.
--
BOFH excuse #342:
HTTPD Error 4004 : very old Intel cpu - insufficient processing power
diff --git a/completions/postconf b/completions/postconf
index 5b998d9..b6e02f7 100644
--- a/completions/postconf
+++ b/completions/postconf
@@ -27,13 +27,8 @@ _postconf()
return 0
fi
- local len=${#cur} idx=0 pval
- for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do
- if [[ "$cur" == "${pval:0:$len}" ]]; then
- COMPREPLY[$idx]="$pval$eqext"
- idx=$(($idx+1))
- fi
- done
+ COMPREPLY =( $( compgen -W "$( /usr/sbin/postconf | awk '{print $1}' )" -- "$cur" ) )
+
return 0
} &&
complete -F _postconf postconf
_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel