From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18477 invoked by alias); 19 Jun 2018 20:21:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43072 Received: (qmail 14322 invoked by uid 1010); 19 Jun 2018 20:21:58 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(-1.4/5.0):. Processed in 0.453707 secs); 19 Jun 2018 20:21:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=lzrM=JF=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1529439712; bh=QZ9gX+T1NW36NkPhekbqShg4UacmEMva1kAliOLym+Q=; h=From:References:To:Subject:Date:From:Subject; b=EQns7R24CdR1T+1D+fi0X/F0o8U9W6y8+e/VEXLj1YTh1z5UmOQLkW2VF0Gg40uL1m9kHvWkZPDgStZkACI+wUtCozh66SOfLKZXq2ynoU8qrsnWPvNmvSOp+n6odKZ3z7aK0DQo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psnHGHis.oXO2MxRZjl1n8OSV_cG7D4i0K4o0PD9gQeFykEWS6_0SYNSx2 4f0BaIg1gi1IHy28Y2CppWHlGs3nbL4EtikR0tMEqS6FCfMxvU7gO2B65sdo- In-reply-to: <20180619125722.GA33230@CptOrmolo.darkstar> From: Oliver Kiddle References: <20180619125722.GA33230@CptOrmolo.darkstar> To: zsh-workers@zsh.org Subject: Re: [patch] Add ldap completer MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17076.1529439708.1@thecus> Date: Tue, 19 Jun 2018 22:21:48 +0200 Message-ID: <17077.1529439708@thecus> Matthew Martin wrote: > For the protocol _describe, is -I correct? I don't grok the differences > between the prefixes and suffixes. For host is -S '' correct for not > adding a space after and should the completer avoid adding the space? You should use -S. The normal way would actually be to have: compset -S ':*' || suf=( -S :// ) Then append $suf to _describe. -S/-P are what you normally use for separators like : / , etc. These work together with the suffix auto-removal. The completion matching is aware of them and considers them for some purposes. -s/-p suffixes/prefixes are included in matching control. So if you use, e.g: compadd -M 'r:|/=* r:|=*' -p "head/" - tail then h/t will complete to head/tail This is behind things like _multi_parts. They are also quoted automatically whereas for -P/-S you might need compquote so these are sometimes used to take advantage of that. -i/-I is akin to directly modifying IPREFIX and ISUFFIX. They tend to be used when bypassing matching but can have other uses. Aside from quoting, they don't behave exactly like a direct modification of IPREFIX/ISUFFIX but that goes beyond my understanding. > The ldapi protocol is not completed correctly because I don't know how > to make _files replace / with %2f. I don't think you can currently without redoing much of _files. You could probably still get _path_files (with -S %2f) to do much of the work. The completion system does track layers of quoting following compset -q but you can't give it custom forms as %2f would be. > + # [protocol://]host[:port][/basedn[?[attribute,...][?[scope][?[filter]]]]] > + if ! compset -P '*://'; then > + tags=(protocol) > + fi > + > + if ! compset -P '*/'; then > + if compset -P '*:'; then In general, where you have compset -P. compset -S is also applicable when completing whatever falls to the left of the separator. > + _tags $tags > + while _tags; do > + _requested protocol && _describe -t protocol protocol protocols -I :// > + _requested host && _hosts -S '' > + _requested port && _guard '|<1-65535>' port _guard was created to solve a particular problem. A quick demonstration of which is the following: _arguments '--long' ':number:' --l now does not complete to --long because number is being offered. I tend to limit it's use to these situations. Even if I've typed some letters, getting the "port" description can still be useful. > + _requested basedn expl 'base DN' > + _requested attribute expl attribute > + _requested scope && _describe -t scope scope scopes If the scope is followed by '?' and a filter, you might want a ? suffix on this. Perhaps in auto-removable form. Or the default suffix could be auto-removable. > + _requested filter expl filter > + done The tags loop is not correct. You need to break out of the loop if matches were added. _alternative would work here. $tags never contains more than one value, however, so the easiest would just be to directly generate matches in each place where you assign to $tags. If you don't like adding && ret=0 everywhere, compare compstate[nmatches] from the start and end of the function. > + ':: :_guard "*=*" "filter"' \ Is this really doing what you want: offering filter only if there is an equals sign in the current word? Oliver