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

Re: PATCH: _rlogin splits up into three functions (still one file)

Bart Schaefer wrote:

> For consideration (i.e., not yet committed).  This makes it a little easier
> to write a wrapper, e.g. Jay's Kerberized version could become
> 	#compdef krlogin krsh krcp
> 	compdef ${words[1]:t:s/k/_/} ${words[1]:t}
> 	_rlogin "$@"
> Though of course that needs to become documented before he can rely on it.


This gave me the idea of adding one more (probably optional, i.e. not
used everywhere) level of indirection when mapping a command name to a 
completion function. So that _rlogin could offer the `services'
`_rlogin', `_rsh' and whatnot. And users could then just do

  compdef _rsh krsh

And the completion system would know that `_rsh' is really in the file 
`_rlogin' and the case-switch in _rlogin would use the `service' `rsh' 
is mapped to.

But maybe this is just a uglier version of what Bart suggests. But I'm 
not really happy with:

> +[[ $_comps[rsh] == _rlogin ]] && compdef _rsh rsh
> +[[ $_comps[remsh] == _rlogin ]] && compdef _rsh remsh
> +[[ $_comps[rcp] == _rlogin ]] && compdef _rcp rcp

That just cries for being automated by compdef, doesn't it?

Otherwise it looks fine, I think. I'm not yet quite sure what this
does with the control flow of, e.g., _pbm (where it is combined with a 
pattern), but, yes, looks promising.


Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx

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