zsh-users
 help / color / mirror / code / Atom feed
* _gnu_generic for aliases
@ 2016-05-19  8:50 Paul Seyfert
  2016-06-02  5:30 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Seyfert @ 2016-05-19  8:50 UTC (permalink / raw)
  To: Zsh Users

Hi,

my situation is the following, I have aliases which are defined
somewhere in /etc/zprofile (i.e. changing where and how the aliases are
defined is not directly accessible to me and can affect other users).

I already wrote my own completion function for them:

_arguments '-c:configuration:->listconfigs'
case $state in
  (listconfigs)
    local -a theconfigs
    # just hard coded strings I don't want to remember/type/mistype
    theconfigs=(x256_777_May x375_324_Jun x942_113_Feb)
    _describe 'config' theconfigs
    ;;
esac

such that I can call the completion with

        fancyalias -c <TAB>

This already covers most of my usages of the alias, but I'd like to improve it
a little more. One of the executables is actually in the PATH so I could test
that the following does what it should do for the executable in the PATH

_arguments '-c:configuration:->listconfigs' ':::->whatelse'
case $state in
  (listconfigs)
    local -a theconfigs
    # just hard coded strings I don't want to remember/type/mistype
    theconfigs=(x256_777_May x375_324_Jun x942_113_Feb)
    _describe 'config' theconfigs
    ;;
  (whatelse)
    _gnu_generic
    ;;
esac

i.e. not only expand -c and its arguments, but also suggests completions on --<TAB>

This however does not work for the fancyalias.

I crosschecked that also

       compdef _gnu_generic fancyalias

does not result in any suggestions. My understanding is that the
_gnu_generic function does not know about the fancyalias / I cannot use
the fancyalias inside the _gnu_generic function.

Is there a way to make _gnu_generic work for aliases?

Thanks,
Paul


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-03  8:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19  8:50 _gnu_generic for aliases Paul Seyfert
2016-06-02  5:30 ` Bart Schaefer
2016-06-02 10:20   ` [solved] " Paul Seyfert
2016-06-03  8:05     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).