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 31057 invoked from network); 19 Nov 2021 15:14:53 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Nov 2021 15:14:53 -0000 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:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:From:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=CWaG2IuKnK/+HxJYTyGzQzjuuwhoEmT1p9jCUxadN1c=; b=e0oNkvfYAhrTldp3wQi7TyoZgS qbwpi5ppHPvppXxlC90YKe7r5RgDjPu6k9g3u1gzyCE1XYvaZ+psEsZdf6E/K7JfDqa3IYPH7IXYQ KGg5ss29unrYF3oHF9nJcHnL04SocAC3j2AWc8u7Il8f3m8S6HMCt7vD2MSDBi/MppF+c5VLqHxmE HbjPM7zAp2YOEDhc8Lnub5RAcmsQIeyiuhKFJ38+60pV2cTKT+HY6pujoXB+V40Hz5QhoCOJ9ch7l ycSVshDVdMZWYyLGTmLEm5TZSn+nzRuwKXk3w38eeZQlv7M9ZRpXof2RcRO493tFAT27bX0erC6n7 vBySw2kA==; Received: from authenticated user by zero.zsh.org with local id 1mo5bH-000PxZ-Hn; Fri, 19 Nov 2021 15:14:51 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mo5b1-000PhQ-SP; Fri, 19 Nov 2021 15:14:36 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1mo5b1-0002yJ-73 for zsh-workers@zsh.org; Fri, 19 Nov 2021 16:14:35 +0100 From: Oliver Kiddle To: Zsh workers Subject: PATCH: completion after chmod -x MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11425.1637334875.1@hydra> Date: Fri, 19 Nov 2021 16:14:35 +0100 Message-ID: <11426-1637334875.215528@cINF.rQGd.ZpAn> X-Seq: 49594 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: The changes I made in 49499 related to _arguments' -A option causes arguments matching the pattern but not corresponding to one of the known listed options to be ignored and not counted as one of the normal arguments. That change does have the potential to cause issues for a command that allows for a normal argument that matches the option pattern. An example of that is chmod where, e.g. chmod -x is a short form of chmod a-x. Fortunately in the case of chmod it is fairly easy to handle this by using a more explicit pattern with -A. For GNU chmod, where we never used -A, the change had no effect. That does highlight the fact that without -A, unknown options continue to be counted amongst the normal arguments. This is perhaps something of an inconsistency. I'm reluctant to make a change to bring them in line without first allowing more time for odd cases such as chmod to surface. Oddities are probably more common on something old like chmod which was designed with hand-coded C option parsing whereas most people now just use whatever option parsing libraries come with their programming language. Oliver diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod index 3f6db7e91..42e3fa63b 100644 --- a/Completion/Unix/Command/_chmod +++ b/Completion/Unix/Command/_chmod @@ -1,7 +1,10 @@ #compdef chmod gchmod zf_chmod local curcontext="$curcontext" state line expl ret=1 variant -local -a args privs aopts=( -A '-*' ) +local -a args privs aopts + +# usual -* pattern picks up valid non-options, e.g. -x which is like a-x +aopts=( -A '-[^gorstuwxX]*' ) args=( '*: :->files' '1: :_file_modes' )