From f853e6a6a1981fce4545d4562e528967276592d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 28 Dec 2009 22:56:13 +0200 Subject: [PATCH] Extract CVS roots completion into _cvs_roots(). --- contrib/cvs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/contrib/cvs b/contrib/cvs index 0c694c7d..a78c2cbd 100644 --- a/contrib/cvs +++ b/contrib/cvs @@ -43,6 +43,15 @@ _cvs_kflags() COMPREPLY=( $( compgen -W 'kv kvl k o b v' -- "$cur" ) ) } +_cvs_roots() +{ + if [ -r ~/.cvspass ]; then + # Ugly escaping because of bash treating ':' specially + cvsroots=$( sed -e 's/^[^ ]* //' -e 's/:/\\:/g' ~/.cvspass ) + COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) ) + fi +} + _cvs() { local cur prev count mode i cvsroot cvsroots pwd @@ -252,11 +261,7 @@ _cvs() fi ;; cvsroot) - if [ -r ~/.cvspass ]; then - # Ugly escaping because of bash treating ':' specially - cvsroots=$( sed -e 's/^[^ ]* //' -e 's/:/\\:/g' ~/.cvspass ) - COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) ) - fi + _cvs_roots ;; export) case "$prev" in