[Bash-completion-commits] [SCM] bash-completion branch, master, updated. d15c096f0b5e4711e50b6aeb4692494c5d4cfacc
Ville Skyttä
ville.skytta at iki.fi
Mon Dec 28 21:45:38 UTC 2009
The following commit has been merged in the master branch:
commit 0b13b03886ea98f54b462743f42cb335510a5b5c
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Dec 28 23:03:24 2009 +0200
Rewrite CVS roots completion, add $CVSROOT and contents of CVS/Root.
Still works poorly because of the colons and -o default.
diff --git a/contrib/cvs b/contrib/cvs
index cfe775a..018e2a9 100644
--- a/contrib/cvs
+++ b/contrib/cvs
@@ -45,13 +45,13 @@ _cvs_kflags()
_cvs_roots()
{
- # TODO: this works very poorly because of the colons
- if [ -r ~/.cvspass ]; then
- # Ugly escaping because of bash treating ':' specially
- # TODO: this ugly escaping doesn't help :P
- cvsroots=$( awk '{ print $2 }' ~/.cvspass | sed -e 's/:/\\:/g' )
- COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) )
- fi
+ local -a cvsroots
+ cvsroots=( $CVSROOT )
+ [ -r ~/.cvspass ] && \
+ cvsroots=( "${cvsroots[@]}" $( awk '{ print $2 }' ~/.cvspass ) )
+ [ -r CVS/Root ] && cvsroots=( "${cvsroots[@]}" $(cat CVS/Root) )
+ COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) )
+ __ltrim_colon_completions "$cur"
}
_cvs()
@@ -60,8 +60,8 @@ _cvs()
local -a flags miss files entries changed newremoved
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ cur=`_get_cword :`
+ prev=`_get_pword :`
count=0
for i in "${COMP_WORDS[@]}"; do
@@ -263,6 +263,8 @@ _cvs()
fi
;;
cvsroot)
+ # TODO: works poorly because of the colons and -o default,
+ # could we drop -o default? works ok without it in cvsps
_cvs_roots
;;
export)
--
bash-completion
More information about the Bash-completion-commits
mailing list