[Bash-completion-commits] ./current r1317: Improved cpan2dist completion
David Paleino
d.paleino at gmail.com
Wed Feb 4 21:22:06 UTC 2009
------------------------------------------------------------
revno: 1317
committer: David Paleino <d.paleino at gmail.com>
branch nick: current
timestamp: Wed 2009-02-04 22:22:06 +0100
message:
Improved cpan2dist completion
modified:
to_review/cpan2dist
-------------- next part --------------
=== modified file 'to_review/cpan2dist'
--- a/to_review/cpan2dist 2009-01-19 20:56:42 +0000
+++ b/to_review/cpan2dist 2009-02-04 21:22:06 +0000
@@ -6,7 +6,7 @@
have cpan2dist &&
_cpan2dist()
{
- local cur prev
+ local cur prev packagelist cpandirs
COMPREPLY=()
cur=`_get_cword`
@@ -24,7 +24,7 @@
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --skiptest --force \
+ COMPREPLY=( $( compgen -W '--help --skiptest --force --install \
--verbose --keepsource --makefile --buildprereq \
--archive --flushcache --defaults --edit-metafile \
--format --ban --banlist --ignore --ignorelist \
@@ -32,8 +32,12 @@
--set-program --dist-opts --default-banlist \
--default-ignorelist' -- $cur ) )
else
+ cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
+ for dir in ${cpandirs[@]}; do
+ [ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && packagelist="$dir/02packages.details.txt.gz"
+ done
COMPREPLY=( $( zgrep "^${cur//-/::}" \
- $HOME/.cpanplus/02packages.details.txt.gz 2>/dev/null \
+ $packagelist 2>/dev/null \
| awk '{print $1}' | sed -e 's/::/-/g' ) )
fi
} &&
More information about the Bash-completion-commits
mailing list