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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5072 invoked from network); 17 Mar 2022 00:27:47 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 17 Mar 2022 00:27:47 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1647476867; b=ZFLQGVLXqIVMhbMXYRZFSJfjwT2Xp6ETnTY8uvy1zLdORRPTDAep45lKiznD7brT6FODeFwyZQ 3gLe7wQLM7xFiZ0Zejbxyg9a7qGIG93LC5nv+CrvutPO2kUMHAfmRK3CmbC6lCBdVeacuoM9Xd lphgVeq/lyji1cJeeEufwR3TmARdTybQSqEnCYiX9+20BcfsrytBWjzD0JEBrQgcSaGeb/GoPj 3sTmpITJ5kEDGFTYXoA4mBZ+PKsdhJbwRaiNfDl2d4ZP+aRctqV9Ag6zLullLi/R86UiQqONSu XNMOfQ+hmIgmkeG7Y/t8LYhUjGq/iBZpPB1v9Y8bFpMo4Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202202e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202202 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1647476867; bh=YdBGn9OLaveQwpiCOxrL8CbhtlAVIAN2zJtvnwJla0s=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:MIME-Version:Message-ID:Subject:To:From:Date: DKIM-Signature:DKIM-Signature:DKIM-Signature; b=W5etcnuPtDQgQvmoL+sSHg/udX0o3f/DlMXk9sX++l5WRLsknPUgtdABQYoMF4JeVtnzY68F3D swTsfc44pcVDtiVzKsKNaKCbYJvLpUKJ/yZW3ue7iyznC9mpfV0KypoRk3aB1u0p5NUv1aQeDc tZgYCHjKa42bq3dNYpIXITrwHgm1Wg89ylQuPXhLFZbBbXTDFU4z8HbOVCbLXnKKXQFaFnCLPt C34yyZRmNvmmqe5lrA/xv7HyLTEO7vpKZluGMfrGEKczlOrJmblzfnjM+x+wyM/2jRbjtRR6hL StMlR2o61eZuRuZyub1jqLmfSmHNlydUh5GCN12Tmu447A==; 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:MIME-Version:Message-ID: Subject:To:From:Date:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=Vg3B3TW044o4SrpianpsiES6weUrCXvuGU7Obb16zC4=; b=UQJLzqHnJ/bgKqGlbjOdSuB0tw XCfBy3grP77v3CnmH4NTngQ92O4YMvlUkKp1iSAQK/sCOW3MxdzlMwqTw1F46NgO2bEd0DTkgZkQn 2Izcg7aHABIZN/naYo+3o4Jqsy/vp+IjOsufAVSFJr+z2NOs5imDmyLrvuTC086ahXeVRfyPBd5QG ksKvNTeFZ/0YaHP3NyNs4ozjYUzuAhc9QR1CMJAsV1et2f/YhuHj5chZU2SaWqkm7pZAAKbORTTei hoo5reWM5xlZsRsnGXf84SaAPRej3azuloliRwWPvyBFkxT6CwiwNcqiMUaHLQD6c4u4jg3F4OrMB R5KzLxOQ==; Received: from authenticated user by zero.zsh.org with local id 1nUdzW-000Har-Gx; Thu, 17 Mar 2022 00:27:46 +0000 Authentication-Results: zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202202e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202202 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none Received: from mx.spodhuis.org ([94.142.241.89]:54103) (DNSSEC AD) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1nUdyi-000Grt-26; Thu, 17 Mar 2022 00:26:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202202; h=OpenPGP:Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:From:Reply-To:Subject:Date:To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:In-Reply-To: References:OpenPGP:Organization:Auto-Submitted; bh=Vg3B3TW044o4SrpianpsiES6weUrCXvuGU7Obb16zC4=; t=1647476816; x=1648686416; b=qSgSCnKfGdt+U2uVv6G0dk1zd9lO89sKLJEKzMy8CqqOz6W7KKPyh6gWQkIdJVOE95s4MfBMDsS g2fAW4iiN1HVxR6oaiT7csWyuzsnUk8VAJLaylN1/dJdPCQRiTJ9rrdhVbeFxkaAfXqfW5A7tdAyX gY4Xofjk4+1gsz4U6Nb1vlv6PofCh7mfW6FvZA3HiFburUAGrIbcZZn05ULlnPpEkv5fcWmR1gTun kLniR1NhJ2aoMFV2mx4D+f1+Tbj1z0pz6P04iXvGCcK/1WyCfWP3Cve/ZIUue/vJyi9ZtD158g9yF h8Bxq43tlqcUQUwHt1m7CAeKYHBRPkCk2ghg==; DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202202e2; h=OpenPGP:Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:From:Reply-To:Subject:Date:To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:In-Reply-To: References:OpenPGP:Organization:Auto-Submitted; bh=Vg3B3TW044o4SrpianpsiES6weUrCXvuGU7Obb16zC4=; t=1647476816; x=1648686416; b=D5KqtDEZZOtjDdoNGuAnLilyy/oybgJRxYZpL8wZA8WPY2laZEsD2Ka139PVEhncQme7+QBmXq5 pg+cN6k+NCQ==; Received: from authenticated user by smtp.spodhuis.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1nUdyh-000Grn-Fz; Thu, 17 Mar 2022 00:26:55 +0000 Date: Wed, 16 Mar 2022 20:26:52 -0400 From: Phil Pennock To: zsh-users@zsh.org Subject: More-verbose tab-completion idiom? Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/keys-2013rsa-2020cv25519.asc X-Seq: 27569 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: Folks, I have a command (`nats`) which takes a "context", and where that can be set as an environment variable. I have tab-completion of these working, based upon knowing where the contexts are stored. Each context is a JSON file in a specific directory, but I mostly only need the name. But, I could provide a more detailed description, by parsing the .description field from the JSON file. AFAIK this is going to be external shell-outs to jq right now (unless anyone has a solid reliable pattern for JSON extraction from a simple KV object in zsh?). This is relatively expensive and I don't want to do it by default. I mean, if most people have at most 3 contexts then it might be sane for them, but I have 35 and while I might be an outlier, I can believe there would be people with more. Is there a standard idiom and keybinding for "go ahead and get the expensive data, to provide me with more details to choose between the options", or would I be creating this from scratch? My completion for this command also gets pointed at by the installer, so I really want to make sure that what I end up with is not a baroque Phil Special but instead something which fits better with whatever the plugin ecosystems are doing, etc. I know about use-cache etc and have that in other completions of mine, so if there's no existing idiom for "trigger expensive completion" then I will use a zstyle to let people request "descriptions" for this completion, and use-cache if that's set. I'm asking in case there's a better way I'm not familiar with. Thanks, -Phil