Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

CVS compctl



Here is mine for CVS:

cvsflags=(-H -Q -q -r -w -l -n -t -v -b -e -d)
cvscmds=(add admin checkout commit diff history import export log rdiff \
            release remove status tag rtag update ci co annotate)
cvsignore="*~ *# .#* *.o *.a CVS . .."

compctl -k "($cvscmds $cvsflags)" \
    -x "c[-1,-D]" -k '(today yesterday 1\ week\ ago)' \
    - "c[-1,-m]" -k '(bugfix cosmetic\ fix ... added\ functionality foo)' \
    - "c[-1,-F]" -f \
    - "c[-1,-r]" -K cvsrevisions \
    - "c[-1,-I]" -f \
    - "R[add,;]" -k "(-k -m)" -K cvsaddp \
    - "R[admin,;]" -K cvstargets -g '*(/)' \
    - "R[checkout,;]" -k "(-A -N -P -Q -c -f -l -n -p -q -s -r -D -d -k -j)" \
	-K cvsrepositories \
    - "R[co,;]" -k "(-A -N -P -Q -c -f -l -n -p -q -s -r -D -d -k -j)" \
	-K cvsrepositories \
    - "R[commit,;]" -k "(-n -R -l -f -m -r)"  -K cvstargets -g '*(/)' \
    - "R[ci,;]" -k "(-n -R -l -f -m -r)"  -K cvstargets -g '*(/)' \
    - "R[diff,;]" -k "(-l -D -r -c -u -b -w)" -K cvstargets -g '*(/)' \
    - "R[history,;]" \
        -k "(-T -c -o -m -x -a -e -l -w -D -b -f -n -p -r -t -u)" \
        -K cvstargets -g '*(/)' \
    - "R[history,;] c[-1,-u]" -u \
    - "R[import,;]" -k "(-Q -q -I -b -m)" -f \
    - "R[export,;]" -k "(-N -Q -f -l -n -q -r -D -d)" -f \
    - "R[(r|)log,;]" -k "(-l -R -h -b -t -r -w)" -K cvstargets -g '*(/)' \
    - 'R[(r|)log,;] s[-w] n[-1,,],s[-w]' -u -S , -q \
    - "R[rdiff,;]" -k "(-Q -f -l -c -u -s -t -D -r -V)" \
	-K cvstargets -g '*(/)' \
    - "R[release,;]" -k "(-Q -d -q)" -f \
    - "R[remove,;] R[-f,;]" -k "(-l -R -f)" -K cvstargets -g '*(/)' \
    - "R[remove,;]" -k "(-l -R -f)" -K cvsremovep \
    - "R[status,;]" -k "(-v -l -R)" -K cvstargets -g '*(/)' \
    - "R[tag,;]" -k "(-Q -l -R -q -d -b)" -K cvstargets -g '*(/)' \
    - "R[rtag,;]" -k "(-Q -a -f -l -R -n -q -d -b -r -D)" \
	-K cvstargets -g '*(/)' \
    - "R[update,;]" -k "(-A -P -Q -d -f -l -R -p -q -k -r -D -j -I)" \
	-K cvstargets -g '*(/)' \
    - "R[annotate,;]" -k "(-l -f -r -D)" -K cvstargets -g '*(/)' \
    -- cvs 
unset cvsflags cvscmds

compctl -K cvstargets -g '*(/)' cvstest 

cvsremovep() {
    setopt localoptions nullglob
    [[ -e CVS/Entries ]] && reply=(`(sed -ne 's:^/\([^/]*\)/[^-].*$:E\1:p' <CVS/Entries; ( ls -a1 | sed 's:^\(.*\)$:D\1:g' ) ) | sort +0.1 | uniq --skip-chars=1 -u | sed -ne 's/^E\(.*\)$/\1/p'`)
}

cvsaddp() {
    setopt localoptions nullglob
    [[ -e CVS/Entries ]] && reply=(`(sed -ne 's:^/\([^/]*\)/.*$:E\1:p' -e 's:^/\([^/]*\)/-.*$:E\1:p' <CVS/Entries; ( ls -a1 | sed 's:^\(.*\)$:D\1:g' ); (ls -ad1 $(echo "$cvsignore"; cat .cvsignore 2>/dev/null ) 2>/dev/null | sed 's:^\(.*\)$:I\1:g' ) ) | sort +0.1 | uniq --skip-chars=1 -u | sed -ne 's/^[^I]\(.*\)$/\1/p'`)
}

cvstargets() {
    local nword args prefix
    setopt localoptions nullglob
    read -nc nword; read -Ac args
    echo "$args[$nword]" | sed -ne "s:^\(.*\)/[^/]*$:\1:" | read prefix
    reply=()
    [[ -e ./$prefix/CVS/Entries ]] && reply=(`sed -ne 's:^/\([^/]*\)/[^-].*$:'$prefix'\1:p' <./$prefix/CVS/Entries`)
}

cvsrevisions() {
    reply=($(cvs -q status -vl . | sed -e '/=======/,/Existing Tags/d' | \
             awk '{ print $1 }' ))
}

cvsrepositories() {
    local root dirs
    root=$CVSROOT
    [[ -e CVS/Root ]] && root=`cat CVS/Root`
    reply=($(echo $root/* |  sed -e 's/CVSROOT//' -e 's:'$root'/*::g') \
    	$(awk '{ print $1 }' <$root/CVSROOT/modules | sed 's/^#.*$//g'))
}



Messages sorted by: Reverse Date, Date, Thread, Author