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

Re: "Bookmarked" cvs repositories



# jrdavid@xxxxxxxx / 2006-11-03 00:57:30 -0500:
> I would like to modify the completion of cvs'
> '-d' option. I created an array like so:
> 
> repositories=( :ext:user@host:/path/to/cvs
>                :ext:user@anotherhost:/path/to/cvs )
> 
> When I type:
> cvs -d<TAB>
> 
> I would like zsh to offer those repositories for
> completion.
> 
> I tried a few things but nothing I did seemed to
> override the _cvs function that comes with the
> distribution.
> 
> Sorry if this is trivial... 

    Well, looking at my 4.2.5/functions/Completion/Unix/_cvs
    I see that _arguments dispatches to _cvs_roots for the -d argument.
    The only obvious customization mechanisms I see there are the
    $CVS_PASSFILE variable or complete redefinition.

    (( $+functions[_cvs_root] )) ||
    _cvs_root() {
      local cvspassfile id slash
      
      typeset -gU _cvs_roots
      
      if [[ -f "${cvspassfile::=${CVS_PASSFILE:-$HOME/.cvspass}}" ]]; then
        if _cvs_loadstat; then
          id="$(LC_ALL=C builtin stat -g +mtime -F '%Y/%m/%d-%T' "$cvspassfile")"
        else
          id="$(LC_ALL=C ls -l "$cvspassfile")"
        fi
        if [[ "$id" != "$_cvs_pass_id" ]]; then
          slash=/
          _cvs_roots=($_cvs_roots ${${${${(f)"$(<$cvspassfile)"}#/1 }%% *}/:2401${slash}/:/})
          _cvs_pass_id="$id"
        fi
      fi
      
      _tags files && {
        compadd -M 'r:|[:@./]=** r:|=**' "$@" -a _cvs_roots || {
          compset -P ':(local|fork):'; _files "$@" -W / -/
        }
      }
    }


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991



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