[Bash-completion-commits] ./current r1273: completion for cpan2dist
Guillaume Rousse
guillomovitch at zarb.org
Mon Jan 19 20:56:42 UTC 2009
------------------------------------------------------------
revno: 1273
committer: Guillaume Rousse <guillomovitch at zarb.org>
branch nick: current
timestamp: Mon 2009-01-19 21:56:42 +0100
message:
completion for cpan2dist
added:
to_review/cpan2dist
-------------- next part --------------
=== added file 'to_review/cpan2dist'
--- a/to_review/cpan2dist 1970-01-01 00:00:00 +0000
+++ b/to_review/cpan2dist 2009-01-19 20:56:42 +0000
@@ -0,0 +1,40 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for cpan2dist
+
+have cpan2dist &&
+_cpan2dist()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ --format)
+ COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' -- $cur ) )
+ return 0
+ ;;
+ --@(banlist|ignorelist|modulelist|logfile))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --skiptest --force \
+ --verbose --keepsource --makefile --buildprereq \
+ --archive --flushcache --defaults --edit-metafile \
+ --format --ban --banlist --ignore --ignorelist \
+ --modulelist --logfile --timeout --set-config \
+ --set-program --dist-opts --default-banlist \
+ --default-ignorelist' -- $cur ) )
+ else
+ COMPREPLY=( $( zgrep "^${cur//-/::}" \
+ $HOME/.cpanplus/02packages.details.txt.gz 2>/dev/null \
+ | awk '{print $1}' | sed -e 's/::/-/g' ) )
+ fi
+} &&
+complete -F _cpan2dist cpan2dist
More information about the Bash-completion-commits
mailing list