From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32591 invoked from network); 1 Sep 2021 11:28:40 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Sep 2021 11:28:40 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630495721; b=YXEzqCpS61xkipw8gcbKW9fRZsqfijAGT5184APOuyMlC+joFll0vXo4AXKX5Zlddzjax5q9zH y6vF4Ew+0hEH+P9kjb2GSBmW2q+VjHVyx2TeUV6sBKpTn2O5TS2DbVYjbNTDu+46VK35RTQaFV wUVh0/KNiL9HPgCCU/h1vzzLlDohJkFbs0QAovjfgsnSawNiPeFDjVD3TshcnJgXshKNyfQCKM VsV8FidUSeQCxuyNFdREc02A1/pvcb7y4XIQSgJrEv8dLLSKMvq64XVje8jPN/mwSScZ7/dKCq kCmgteXagEPo3BvI7v/Iz8mBB8AeV8n4aI+kq65JWAu7Gw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ua1-f41.google.com) smtp.remote-ip=209.85.222.41; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630495721; bh=0BahlBFv8dCMNfMR1ajtJEt9gT/DtzaInjiVbY6ZxJs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=ljWcJJ6DdZUVDxjXE7JRN5Y22n0Uq0lHWhyCq4szmbKnRfbe612OU9MbE5D/7z2NDV91L6VhGa y02Q586NkCt5zElXtAk3Tmzls6KkhvQPd2YhwsCuNXrzt7aZuaQHlRvc8sdqWXZ28VXEqa3QpN yuqQlynzD2JBaw4RA4g6mOA8+W48OrH/mpsEDVy3B1EpdMiSa+EGU0ciW2B8w1Lr5MfFNWFFXT jMonirKOBw3lrzfGtj3Vy7D2/hoNPgiktLuqEdejgwOMy9KxjsE8H/69V/L5BJo50v8cS4CD4t 5TcFEbA4HqifiIPiiqXzXmXz0FjFCQo+OHQ9pFrbRa1cYg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=x14ewno3ePLo7vm/6MpbjU7jZJmp8xXnxgoFYA/4QS0=; b=p9gkn1CKAUnk6n1DBD4NzK2AlJ BMzDfDPYKhnsD+VGEtvPnsxLX74OnchrUoENCps6jdJeaY0ptrZ3J2nMZhThU+Ln+mCGGo1PFnOiR dUNmTFckfQg58PR1bdmbhmz8xYbRQeejzqugToG3tib78YM+A652M/IFwN75lzXtmPZpgSb2DQI1z qoP4tuMwSsilGCPILLCKa9s4t83su659c7X83Br6GfYzCTcslLhZku/Orp7bjtVorkWteuqWfzUAI gL2g1ijnZPY+95Kz4giWrmHXuL6IIwpBTEaYZLaLy4jc8qtVHmN5sNjVrLO/HcPCqTfBlEQbpbwEQ 2KcHFetQ==; Received: from authenticated user by zero.zsh.org with local id 1mLOQ3-00097Z-JR; Wed, 01 Sep 2021 11:28:39 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ua1-f41.google.com) smtp.remote-ip=209.85.222.41; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ua1-f41.google.com ([209.85.222.41]:33714) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mLOPM-0008Q6-Rr; Wed, 01 Sep 2021 11:27:58 +0000 Received: by mail-ua1-f41.google.com with SMTP id a14so1177186uao.0 for ; Wed, 01 Sep 2021 04:27:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x14ewno3ePLo7vm/6MpbjU7jZJmp8xXnxgoFYA/4QS0=; b=lh/3fRzQlfbEPMukMkwL6V8Rb06BHCpUaWXqP6WcVI+KdliOyNZp2DO69/YiX86MuI nabih3S3tyS+mQgrXvEWNR8Ru/sEHEEQJ68qd5DWdxD6JjqIEF6bPTY90bKfbFp5nIhN HSa5zbDMSmbZx7L96c2Cnb9DHOIABHUyPCXeSXCtA7mVNv2MnQXgORB9FwJGYFGa/oso EcGZFNmoxjWWyK/lRjvAgoBYbjUCjZ9RnEOaHK+Lya7nSskxMpVZE5FusiWmC6vkXSv2 FH7/czfEbqGBaFp4IvWbyc5VcQAsVmYJgyrWhxbpLPiKAjhIviVsjTQDmfze9UcJbMCL H4Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x14ewno3ePLo7vm/6MpbjU7jZJmp8xXnxgoFYA/4QS0=; b=qmVGiECNjOMTjhMKIH6P7chy31+eEajp7QLr5XYeElFhd9eATpQZJeX+L7inhDhgg6 VWBRwOGmdZ0MNC7DLZ8zeyUSsp6LwG3QxCJDjI6YPb1HFiG6wCm5GdiPQH840VVcHBcB +Sy4Pdvyw4PB8B/1joXdWZR9E19BrXThURqYgTtGUckmIExdCBhhPcOOz/CSF6nTKVOJ wX10jXTMYS+lidhYEHZ4IqUhFFyfYQ3XJiROb3mtRkVDeTn1m3x5Gp+kZ+oUK7ZKQyQZ bjoHMquG41p4MFcp9q4Jn6tnBrs+5Kk1Jb8dQws3XUdM9hsgdxJUjwyaWKkNrfznFXOE R7dg== X-Gm-Message-State: AOAM533ad/el5o3lcmrE8h4qOtuWLCv1RZpNFtaIWL6270JQO2AWUfxG XOJxJIH4aC3KsDyRtU9GjLk+kGOypCXBjmN9+EQ= X-Google-Smtp-Source: ABdhPJx6ut3QwqvSBjzoRm3AYvO30ELjmy9AMm9CDObOx47KEKthqcvNoW7m/a1wuhWXds+hHI+44nYVhcTyBjYFSK0= X-Received: by 2002:ab0:734d:: with SMTP id k13mr22368751uap.64.1630495675668; Wed, 01 Sep 2021 04:27:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Marlon Richert Date: Wed, 1 Sep 2021 14:27:19 +0300 Message-ID: Subject: Re: Completion: How to show description for current option? To: Bart Schaefer Cc: Roman Perepelitsa , Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27049 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Wed, Sep 1, 2021 at 3:23 AM Bart Schaefer wrote: > > On Tue, Aug 31, 2021 at 10:22 AM Bart Schaefer > wrote: > > > > That might be all that's needed; a matcher-list entry that allows '-' > > to become '--'. But I suspect there's something deeper going on in > > the _git suite. > > Indeed, the _git suite of functions almost always use _alternative, > which calls _describe with a hardcoded matcher which is prefixed to > whatever appears in the matcher_list style. On line 41 of > _alternative: > > _describe -t "${def%%:*}" "$descr" ws -M 'r:|[_-]=* r:|=*' "$subopts[@]" > > I believe that makes it impossible to write a matcher-list zstyle that > will swap out "-" with "--" in the context where Marlon wants it. Can > someone demonstrate a workaround? Thank you all, but unfortunately, none of this is addressing the actual problems I'm trying to solve. Let me try to rephrase: # Problem number 1 When I type, for example, git switch -c^D then completion shows me only -c instead of -c create and switch to a new I would like to be able to see the description to check if I'm actually using the right option. # Problem number 2 When I type, for example, git switch -c^D then completion shows me only -c _even if_ I have a matcher (of which the details are not important for this question) that would actually also match --conflict and --create. The problem is not in the _git completer (I'm just using `git switch -c` as an example here) nor in my matchers; the problem is in _arguments. For whatever reason, if there is a single option that matches exactly, _arguments decides not to print any description for it _and_ also refuses to complete any other matching options at that point. Is there a way around this? Or have I run into an _arguments bug? The relevant code can be found on lines 489 - 525: if [[ -z "$alwopt" || -z "$tried" || "$alwopt" = arg ]] && comparguments -s single; then if [[ "$single" = direct ]]; then _all_labels options expl option \ compadd -QS '' - "${PREFIX}${SUFFIX}" elif [[ -z "$optarg" && "$single" = next ]]; then _all_labels options expl option \ compadd -Q - "${PREFIX}${SUFFIX}" elif [[ "$single" = equal ]]; then _all_labels options expl option \ compadd -QqS= - "${PREFIX}${SUFFIX}" else tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" ) [[ "$PREFIX" = [-+]* ]] && tmp1=( "${(@M)tmp1:#${PREFIX[1]}*}" ) [[ "$single" = next ]] && tmp1=( "${(@)tmp1:#[-+]${PREFIX[-1]}((#e)|:*)}" ) [[ "$PREFIX" != --* ]] && tmp1=( "${(@)tmp1:#--*}" ) tmp3=( "${(M@)tmp1:#[-+]?[^:]*}" ) tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" ) tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" ) _describe -O option \ tmp1 tmp2 -Q -S '' -- \ tmp3 -Q [[ -n "$optarg" && "$single" = next && nm -eq $compstate[nmatches] ]] && _all_labels options expl option \ compadd -Q - "${PREFIX}${SUFFIX}" fi single=yes