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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 18152 invoked from network); 4 Jan 2023 00:25:16 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Jan 2023 00:25:16 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1672791916; b=r4gBDggo/3JTJqN2hBxQqx9BESSApszuqB4hZvYcAI/NFpQBqe7IWIhmQLkOmQWCFZ5/Fg6Y1I rSu1PO8bOV/wM2hBFXVKgOvW3XBX6w95hv6hU4dm6gDZmeNCiOHHx5qGMOkO8sfYLQfr1wv0LI tthSvFCib7Y4eVgGK3FP7jTUA7nA1SkfnC0lPpwgLpsAGaTFzGbMjCQ1CNE1Wo/1YS/HSwvflt L9IYWafewIGSAXSy9HDJ1XUOZPp7mN9CHz+GRo7PdegCkF2+leEy4ROfZ018SR2AALiJtkeOF5 R/RlQXZIUhM1ADtdlXy94EkKsgJ3ATJwVeRstCYl+jBHwQ==; 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=d202211e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202211 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=1672791916; bh=/BmfkaYoqqS6x2KZWkCdDn6dhE9+wb2pJYXFDA/r1KM=; 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=M3fBrypE9Ru83byR7B2gZ+SJhXyozdiS26O40BXLaR0xY99Mb3MrM+qUvIAXB0wLWB6LFWp3dd RYmtnYYPubPQZdBiGrka/5LcAhbJft5zm0eg4uCUd3uLbpP666A1zmaaKaLHVs03O+L1pqGVX9 VzAoR7xIZ4sidLX9ZXzkCYV+83toY5lpe15VElC3QoBAKD5VK3k3kUZixiIKBlofewH7/NGWFD dOnE7j0g8SznG4IUtR8glDVVuY/HaPnKCVILE7fTMkbWTbE0VQpe+Q3ENl9nb/kCKu08glgw/7 QsS/KwLjGjcxecE4sY+SPyq9ACzBvl7oRjk/b92T0kwVAA==; 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=CaUszBgQj4sb0osJcIdDYZXNBIYqHmlvtm7we4peh4s=; b=kCRB2KM/Ok+xeW3xLHvJsBigrV 3NjIuCSwmS1jrm1/UAlmu/tq8Qr6Wr/5/yD90peDtloWMFI8l2/f2XrzBTN/GYGSlvJxR3QIDEaT4 KfKHa3iwP3Gt+60mXjWkq6/qoJdA2A4aOQRiMexLADO/dkq/Zh4vQ3UO6ixZqX4eE/P+8PGQhJO+H glm2lTj4ckdG0VRyOm1rzzH9imKfoR1CXJUE8bBG9L1MuRJGVRFb+3R3EF+IfPw1Jl+SboLGZiYOI f/1a5LG00Pgb0602HleGJbVX4ubDx6peKiRZRYggBk1f2LgtXohqf8wSC2mSJE+xJOKWLx+IVCgCb pN36giNw==; Received: by zero.zsh.org with local id 1pCram-0002Oh-7l; Wed, 04 Jan 2023 00:25:16 +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=d202211e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202211 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none Received: from mx.spodhuis.org ([94.142.241.89]:35844) (DNSSEC AD) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pCrZa-0001dz-GA; Wed, 04 Jan 2023 00:24:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202211; 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=CaUszBgQj4sb0osJcIdDYZXNBIYqHmlvtm7we4peh4s=; t=1672791842; x=1674001442; b=mgndLQDK0QJhv9ACofQe/d+xyIRVHDZdH4sRoH+ZxXrC4XLy4Xv8seVpVbV8WQ025bFetRVyYV/ EplcXAw6wsX0bOaeaAwnB+5dQMSZRJvsyZxz7RoO6mhTdf7U+gWYw2IFyQO1BgxdrW+81Gew7uRD3 g/H5vb4W6c3RH/YBVF2X/eIQ3zLAzoxdITSXwSC5XPEV2Lt/Z3UFR77Wl++/Dhps9BSOwyaiHrX1r ZsbitDW5sXeqfbVSXH2O6kpYiCD+ZUkOcxV6ZNJDUQVJMD2iAx9NZBeA6IgubkJC6NtoQOvbBXwrh A8BOfCMwousTeO9aXBgPZQB1v3ivz+TYuLMQ==; DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202211e2; 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=CaUszBgQj4sb0osJcIdDYZXNBIYqHmlvtm7we4peh4s=; t=1672791842; x=1674001442; b=lSXeglaOHBejSHYrWplivK77XVippTAlLQBV/kc6xRZ/CuKBC0rRtm+jh/GHnJWQ70PNlfsjRWF mO1ztGIYfBA==; Received: from authenticated user by smtp.spodhuis.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pCrZZ-0001dq-U5; Wed, 04 Jan 2023 00:24:02 +0000 Date: Tue, 3 Jan 2023 19:23:59 -0500 From: Phil Pennock To: zsh-users@zsh.org Subject: completion of normal commands after -- 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: 28613 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-wrapper, which can end its own options with '--' per POSIX, and then _after_ that take the command to be run. This is something I see with a lot of modern devops-style tools. In this case, the tool is aws-vault; one of the sub-commands is 'exec', which needs a profile-name and which has flags, which can appear before or after the profile-name. After the profile-name is the command to be run, and it's recommended that you use -- before it if the command takes options of its own, because otherwise the aws-vault _will_ take those as its own options. So you might run: % aws-vault exec profile-foo -n my-command its-flags-and-args I have it _almost_ working. I can see it taking parameters for aws-vault after the profile name, I can see it switching to _normal execution and tab-completing commands from the path. The problem comes with losing tab-completion for my-command's options. Eg, I should be able to run: % aws-vault exec website -- ls - and see the tab-completion for the ls(1) command. Instead, at present, I can tab-complete the first word after the '--' and no further. (Without the --, it tab-completes aws-vault's options, which is unfortunately correct: they'll be stolen). (exec) _arguments -s -S -C \ '(-d --duration)'{-d,--duration=}'[duration of temporary or assume-role session]:duration' \ '(-n --no-session)'{-n,--no-session}'[use master credentials, no STS session]' \ '(-t --mfa-token)'{-t,--mfa-token=}'[the MFA token to use]: ' \ '(-j --json)'{-j,--json}'[be an AWS credential helper]' \ '(-s --server --ec2-server --ecs-server)'{-s,--server,--ec2-server}'[run EC2 metadata server in background for credentials]' \ '(-s --server --ec2-server --ecs-server)--ecs-server[run ECS credential server in background for credentials]' \ '--region=[the AWS region]:region:_aws_regions' \ '--lazy[When using --ecs-server, lazily fetch credentials]' \ '--stdout[Print the SSO link to the terminal without automatically opening the browser]' \ '1:profile name:_aws_profiles' \ '2:: :->wrapped-command' && return case "$state" in (wrapped-command | '') # '' for the '--' scenario shift $CURRENT words CURRENT=1 _normal -p $service ;; esac ;; Guidance appreciated, and thanks in advance, -Phil