summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-10-23 11:13:50 +0300
committerVille Skyttä <ville.skytta@iki.fi>2011-10-23 11:13:50 +0300
commitc922626d4b9b78d266c8336c702b4c5e9a0325d4 (patch)
tree032f1bf503518b36e508b5478f125badbceb852e
parente8d0b1ffdb585486e6b94fa0226cd4e9e86b142a (diff)
downloadbash-completion-c922626d4b9b78d266c8336c702b4c5e9a0325d4.tar.gz
cpan2dist: Don't hang if no package list files exist.
-rw-r--r--completions/cpan2dist5
1 files changed, 2 insertions, 3 deletions
diff --git a/completions/cpan2dist b/completions/cpan2dist
index 9845a0a5..4ec33c0b 100644
--- a/completions/cpan2dist
+++ b/completions/cpan2dist
@@ -30,9 +30,8 @@ _cpan2dist()
[[ -d "$dir" && -r "$dir/02packages.details.txt.gz" ]] && \
packagelist="$dir/02packages.details.txt.gz"
done
- COMPREPLY=( $( zgrep "^${cur//-/::}" \
- $packagelist 2>/dev/null \
- | awk '{print $1}' | sed -e 's/::/-/g' ) )
+ [[ $packagelist ]] && COMPREPLY=( $( zgrep "^${cur//-/::}" \
+ $packagelist 2>/dev/null | awk '{print $1}' | sed -e 's/::/-/g' ) )
fi
} &&
complete -F _cpan2dist -o default cpan2dist