From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 092bed83 for ; Fri, 6 Mar 2020 15:22:15 +0000 (UTC) Received: (qmail 11966 invoked by alias); 6 Mar 2020 15:22:05 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24716 Received: (qmail 9966 invoked by uid 1010); 6 Mar 2020 15:22:05 -0000 X-Qmail-Scanner-Diagnostics: from mail-il1-f169.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25738. spamassassin: 3.4.2. Clear:RC:0(209.85.166.169):SA:0(-2.0/5.0):. Processed in 1.327387 secs); 06 Mar 2020 15:22:05 -0000 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.169 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=6Lg2XZ633r7mn724tfJSPer+etf/QdfxTVAvXH7cZYo=; b=t0qxwrUq12WfUUS9cTjKzvKSY5Rpw9wByy/NswLHVeYXO47oENAg7z5fr4NLdWJhh3 zbvIOlnZ1bHY4EYRuBreSi1EpMw34lwtVwb3hJtzWd1ccD4sKs/4uzHFwHji+At/RGuX X3+/xR+ayVMQRUrdndDFdRKqN+NzHwSlf5ZILN1tXGkv1pdhArmE9vp4oc0iyFogsYY8 G2muG1Hb+cgOYLw+OB8Ir5po7OBnzHm4hcvg75buWxOv7IErvh76/UHRGk2QuFDCt9t0 YaarfFcdmnTi64mWdLlr5nS/IX4MWwiGdeSHbrSuEwXGrWhp58nRGBE0zzbjVpOli2Je VZrg== X-Gm-Message-State: ANhLgQ0cW427tCDsouWlVrVQgOD344wIKeFJkClcNF0Gu+TjuQHB6UCW NwS4FbIz5efJw7X8WlRiNXOr3z4DCNpulwjuYZZarQ== X-Google-Smtp-Source: ADFU+vv4y4PXFW40Rn1jA+C/yI1+nsHK655txtm95Wwl2tcLDslk5qWOTZv7fR6OUYfWJ9mbB+aoi9+GyPzbkw9kfCA= X-Received: by 2002:a92:3d42:: with SMTP id k63mr3529665ila.219.1583508090866; Fri, 06 Mar 2020 07:21:30 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1583488261.4530.3.camel@samsung.com> References: <1583488261.4530.3.camel@samsung.com> From: Mikael Magnusson Date: Fri, 6 Mar 2020 16:21:30 +0100 Message-ID: Subject: Re: completion for 'alerter' To: Peter Stephenson Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" On 3/6/20, Peter Stephenson wrote: > 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. A minor correction that this should say "#compdef alerter" without the underscore, or it would just complete options to the completer. -- Mikael Magnusson