zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-users@zsh.org>
Subject: Re: completion for 'alerter'
Date: Fri, 6 Mar 2020 09:51:01 +0000	[thread overview]
Message-ID: <1583488261.4530.3.camel@samsung.com> (raw)
In-Reply-To: <CADjGqHsBxpfpoNNS-5D1SJTzMdnjE-Y+B4qfkwMW1ddVSSiLww@mail.gmail.com>

On Thu, 2020-03-05 at 23:45 -0500, TJ Luoma wrote:
> These are the options for `alerter`
> 
> -help
> -json
> -message VALUE
> -remove ID
> -list ID
> -reply VALUE
> -actions VALUE1,VALUE2
> -dropdownLabel VALUE
> -title VALUE
> -subtitle VALUE
> -closeLabel VALUE
> -sound NAME
> -group ID
> -sender ID
> -appIcon URL
> -contentImage URL
> -timeout NUMBER

Best thing to do for something like this is to copy another
straightforward completion.  For example, a search for something that
handles '-help' reveals Completion/Unix/Command/_tardy in the zsh
distribution --- it doesn't get much simpler than that.  All you really
need to know here is that if there is a colon, the thing immediately
after the colon describes the argument; if there are two colons, the
stuff after the second is completion of the argument (e.g. your VALUE or
ID); the stuff in parentheses is literal value to be completed, and the
things beginning "_" are completion functions to be called to add the
values.  There are functions you can call for pretty much anything
generic e.g. _urls for (surprise!) URLs.  Copy it to _alerter, change
the line at the top to say "#compdef _alerter", change the list of
options, and that's it basically working.

If you want a professionally edited step-by-step guide, your best bet is
probably Oliver's chapter 15 from From Bash to Z Shell,
http://www.bash2zsh.com/ although that web site does have some other
potentially useful links.

pws


  reply	other threads:[~2020-03-06  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200306044721eucas1p2ef2d8e761171b32b9c49ac98cd8fce8b@eucas1p2.samsung.com>
2020-03-06  4:45 ` TJ Luoma
2020-03-06  9:51   ` Peter Stephenson [this message]
2020-03-06 15:21     ` Mikael Magnusson

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=1583488261.4530.3.camel@samsung.com \
    --to=p.stephenson@samsung.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).