zsh-workers
 help / color / mirror / code / Atom feed
From: Vorpal <zsh@vorpal.se>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Programmatically loading completion for another command?
Date: Fri, 27 May 2022 18:29:56 +0200	[thread overview]
Message-ID: <946346f8-5df9-d551-d199-bf62e0267b41@vorpal.se> (raw)

Hi,

I'm writing completion for a command that has an option like:

   --makepkg-args=comma,separated,list

where the comma separated list are arguments to the makepkg command.

I thus though I could use "_sequence _makepkg". Unfortunately this 
doesn't work if the user hasn't tried to tab complete "makepkg" yet.

Even more annoying _makepkg is defined in a file with a different name 
(_pacman) and the following #compdef at the top:

#compdef pacman pacman.static=pacman pacman-conf pacman-key makepkg

I.e. _makepkg is not the main "service" of the completion definition 
file. That file has a main completion function that dispatches on $service

* How do I trigger loading that file from my completion so I can offer 
completions to the flag --makepkg-args? Is it even possible?
* Or should I make a wrapper that calls _pacman and overrides $service 
locally?

Both of these approaches seem rather hackish. It would be nice if I 
could ask zsh: give me whatever is used to complete the command "makepkg".

Best regards,
Arvid Norlander


             reply	other threads:[~2022-05-27 16:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 16:29 Vorpal [this message]
2022-05-27 17:03 ` Bart Schaefer
2022-05-27 17:46   ` Daniel Shahaf
2022-05-27 19:58     ` Vorpal
2022-06-02  4:09       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=946346f8-5df9-d551-d199-bf62e0267b41@vorpal.se \
    --to=zsh@vorpal.se \
    --cc=zsh-workers@zsh.org \
    --subject='Re: Programmatically loading completion for another command?' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).