zsh-users
 help / color / mirror / code / Atom feed
From: Ahmad Ismail <ismail783@gmail.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-users@zsh.org
Subject: Re: how to use tags in zsh completion system
Date: Wed, 26 Aug 2020 17:28:15 +0600	[thread overview]
Message-ID: <CAHAhJw+-jWgOxeKp=94VXEJnRvj7G2NTWrUOVW_96UB8RXr=nA@mail.gmail.com> (raw)
In-Reply-To: <441849700.1433895.1598439442873@mail2.virginmedia.com>

[-- Attachment #1: Type: text/plain, Size: 4045 bytes --]

Hi Peter Stephenson,

This is the first time I am using a mailing list. So, I am not sure whether
I am doing it correctly or not.

Do I need to always refer to my previous mail or will you be able to figure
out my previous mails?
Do I need to view my email and its correspondence from
https://www.zsh.org/mla/ or everything will be in the inbox?

Being said that, I tried:

% scp
tags in context :completion::complete:scp::
    argument-rest options  (_arguments _ssh _ssh)
tags in context :completion::complete:scp:argument-rest:
    files hosts users  (_ssh _ssh)
    globbed-files      (_files _ssh _ssh)
    hosts              (_hosts _combination _ssh_hosts _ssh _ssh)
    users              (_users _combination _ssh_users _ssh _ssh)

% scp hosts
tags in context :completion::complete:scp::
    argument-rest options  (_arguments _ssh)
tags in context :completion::complete:scp:argument-rest:
    files hosts users  (_ssh)
    globbed-files      (_files _ssh)
    hosts              (_hosts _combination _ssh_hosts _ssh)
    users              (_users _combination _ssh_users _ssh)

I am sorry, I can not understand what the output means.

The documentation says:

"typically indicating a class of object that the user may need to
distinguish."

"Unlike the contexts (which tell you how completion arrived at the point it
did), the tags describe the things it can complete here."

If you will be kind enough to explain with the example you were talking
about then it would be very helpful for me.

If you kindly make a completion function with more than one tag (Ex.
frooble1, frooble2, frooble3) and description of how they were useful. And
how that function can be used with `zstyle ':completion:*:aliens:*'....`
then I will be very glad.


*Thanks and Best Regards,Ahmad Ismail*

On Wed, Aug 26, 2020 at 4:57 PM Peter Stephenson <
p.w.stephenson@ntlworld.com> wrote:

> > On 26 August 2020 at 09:59 Ahmad Ismail <ismail783@gmail.com> wrote:
> > The [documentation][1] says
> >
> > >     zstyle ':completion:*:aliens:*' tag-order \
> > >       'frooble:-funny:funny\ frooble' frooble
> > >which is used when you're completing for the command aliens, which
> > presumably has completions tagged as `frooble' ...
> >
> > I understand that both context and tag can be viewed using
> <kbd>^Xh</kbd>.
> > So, I tried the following command but suggestion did not show the tags.
> >
> >     % zstyle ':completion:*:aliens:*' tag-order 'frooble:-funny:funny\
> > frooble' frooble
> >     % aliens <kbd>TAB</kbd>
> >     Completing file
> >     Desktop/       Documents/     dotfiles/      Downloads/
> >     % aliens <kbd>^Xh</kbd>
> >     tags in context :completion::complete:aliens::
> >         globbed-files  (_files _default)
> >     % aliens frooble <kbd>^Xh</kbd>
> >     tags in context :completion::complete:aliens::
> >         globbed-files  (_files _default)
> >
> > I think I am doing something wrong with
> >
> > > completions tagged as `frooble'
> >
> > Please help me understand how to use tags in zsh completion system.
>
> Hi Ahmad,
>
> That section in the guide is actually just an example of how things work
> using an invented command --- your understanding is basically correct but
> actually there is no "aliens" command.
>
> Just off the top of my head (other people may have their own favourite
> examples), one interesting command with a number of different tags
> that apply at the start of completion is scp: ^xh for that gives me
>
> tags in context :completion::complete:scp::
>     argument-rest options  (_arguments _ssh _ssh)
> tags in context :completion::complete:scp:argument-rest:
>     files hosts users  (_ssh _ssh)
>     globbed-files      (_files _ssh _ssh)
>     hosts              (_hosts _combination _ssh_hosts _ssh _ssh)
>     users              (_users _combination _ssh_users _ssh _ssh)
>
> so that might be something to play with.
>
> (Alternatively, if I got my act together I could probably write
> a fake completion for "aliens" that actually did what the guide
> says...)
>
> Cheers
> pws
>

[-- Attachment #2: Type: text/html, Size: 6135 bytes --]

  reply	other threads:[~2020-08-26 11:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26  8:59 Ahmad Ismail
2020-08-26 10:57 ` Peter Stephenson
2020-08-26 11:28   ` Ahmad Ismail [this message]
2020-08-26 12:01     ` Peter Stephenson
2020-08-26 12:39       ` Ahmad Ismail
2020-09-04 19:23   ` Daniel Shahaf
2020-09-05 11:29     ` Ahmad Ismail

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='CAHAhJw+-jWgOxeKp=94VXEJnRvj7G2NTWrUOVW_96UB8RXr=nA@mail.gmail.com' \
    --to=ismail783@gmail.com \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@zsh.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).