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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25008 invoked from network); 4 Jan 2023 22:44:40 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Jan 2023 22:44:40 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1672872280; b=RdQbZ387GZNqCDzgZSdECzA9J+WnUbBBWrQZGGAu5cvFLk4LxIQgoyZPhwC4uvwWGp3sLyvQza eGy4RxI93ZkR1Ybr6zY/kAah4pagK+P7X9fJ/exRTLv1t/Z/6ZZ3neWULrbbY0jQjALaVwp5Ku lGT46EO6twiZUH5dVGc4sP9jLM1Q/g+mYM24U36cMEKvIc67BYIfNh3MmHqgksh84hC0L2XcS0 WUoagjnu3lonyl+KXKubP+eQHPmjJLvWn0u/0/zR0zdy/PsDgcVJFV/Cgszc37KyZBvKWwpiPt dbQhKmNMXI6U4yQ0YbaO2+rrExhRvj062MMGWz5XWCoZEw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout1-smtp.messagingengine.com) smtp.remote-ip=64.147.123.24; dkim=pass header.d=brainwerk.org header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=brainwerk.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1672872280; bh=CRopwxX1tyR9qVn5RK5AmqExMvWFGGnEFPeMbiFCiNg=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:Cc:To:From:DKIM-Signature:DKIM-Signature:DKIM-Signature; b=HkbOah+ZaP2Hw+cS+DDLPVbYvK4Y9O7YyrUVPCRZsI3WmyzzeQFGcm1qxwyoY83W1RKonLcPt6 FHHf2UFYYUQJ7kRB3/eCg4GkWAhfjj73Q594F+0KLyL2xx72awDol+wfGYpFCPZMtzrKIDIqTG 3iyXDsJyDWs7Io5MsFumC9SOpZiVnyT6a6Kbf/72Lm4RVdVgnKc3zPigfHuCG0O2iqbLWpMRyY Uy6RUQnbY3kpDkcAi8UVSbH5eIzKKDa8VFoRgqPIFc7Lux/Uw+zAqKotbcRf2rXtTQI8GToBLq Yo/hpAwT7Onlmj6EQKXu0A4Ix/slglXdh6QQqDEAIrBQIg==; 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-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=Whsy6ATwQA5WepVybAR3kF2rWOwVBzBlz3uJKbFEM/o=; b=bLI/mIMe7h+i18tsgBqEiNpTME mJgNFm5PvfkI8mhgTJYJO2uBbEQ3EE7r1WsUiryOG8+9Yv4/HNYfrlEEqNUL8Xf9rLoWZYk/ARzFO gTCbvRxZSuVHMWdT20TFWr8sbRW6arpb0xnNrdqlNLjqYp6pMkMf2rYHl+Fb3RiZxuQvFeUTPqw5w 3eCiYWuNbW82c2CQWHiBONfotmTDUqcnrDa46xU3RIX+1TRiYjP+4y7iTaVBD2I8z0H88xp4y7ww6 Ozw/IaVFvrbNGniBmgad0erHzBROzs/RPkomTQ3wKQiuqZKbPaK3SAzq/BLBV+vbXJQi5YuadTmm0 XMdpWIog==; Received: by zero.zsh.org with local id 1pDCUx-000Ced-Cn; Wed, 04 Jan 2023 22:44:39 +0000 Authentication-Results: zsh.org; iprev=pass (wout1-smtp.messagingengine.com) smtp.remote-ip=64.147.123.24; dkim=pass header.d=brainwerk.org header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=brainwerk.org; arc=none Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:48957) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pDCUh-000CMc-Lm; Wed, 04 Jan 2023 22:44:24 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id C72C23200684; Wed, 4 Jan 2023 17:44:21 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 04 Jan 2023 17:44:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainwerk.org; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm2; t=1672872261; x=1672958661; bh=Whsy6ATwQA 5WepVybAR3kF2rWOwVBzBlz3uJKbFEM/o=; b=blUmGMpIOO+qqkN5F+KCi5A6rw /RH9q5cZB1SO8SUPVIQS4J6ooE/o8e+sCafgFk80oMlx8qxrxrNnkd5acUXLZ8aq JrRGlTrHuhg4Kx559+rTpiA7vSg+npUFirOdNqREdbHGWR1aLk9BqKDlFrS3TuTK aemWimY/O14bKz06GcKSGS019ZlN2oONItrrwRkm4WC0raJ/e3M/CqlgKxSCdR+f 3P38otCVlIE6xDwMSZ4XGHhrakt9mGlOxIUBBP2jvwXEXk1Kt/GhbjDFKuQlS/yf QsedxUvhgaHiSLqLlW5TgW8vBnBW1RgzDwJn81ZKq4oX7If5mzHJuNyMy/xQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1672872261; x=1672958661; bh=Whsy6ATwQA5WepVybAR3kF2rWOwVBzBlz3u JKbFEM/o=; b=rQSjQdLzznUVukbywEaLnQGUkK6Uoj0X1cfGD1xp54Gy1st25rt uQmHwAOGeBSsgzT6q8+99pyLmFlBqC628hcDfJ4kdwfRyV0aRC9Wc2Igtj68AAuI LqSIcj2PVqK6ghALFC+vSsiRWEcAO51Ar7iUJ7E/E4fTppeAK/rW1Xa1yMwbR5/C ekmkyG8IU1f3PEynBfbSTyLqbJIoQ7QPvrLP6mDMuMgIgJrOPQ8rMkoTEgjQcifv EK/m/JPVpyPlNv/h4M01uUilc2pLFXrPwPxsO2hNmLV8U+5tNZ2SdNihdi9GY+xm Cozs0Ic+WaZ8kClUzJ09/ZNnFtlZFpvI1TQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeejgddtudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgggfestdekredtre dttdenucfhrhhomheppfgrthhhrghnucfjohhughhhthhonhcuoehnrghthhgrnhessghr rghinhifvghrkhdrohhrgheqnecuggftrfgrthhtvghrnhepveevfeejheekveduffdvke ehvdefjeeljeehfeefheekffeltdfgffejkeefieehnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepnhgrthhhrghnsegsrhgrihhnfigvrhhkrd horhhg X-ME-Proxy: Feedback-ID: ibb394747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Jan 2023 17:44:20 -0500 (EST) Received: from localhost (iron.brainwerk.org [local]) by iron.brainwerk.org (OpenSMTPD) with ESMTPA id d36d7182; Wed, 4 Jan 2023 14:44:19 -0800 (PST) From: Nathan Houghton To: zsh-workers@zsh.org Cc: Nathan Houghton Subject: [PATCH] Fix diff completion for non GNU / FreeBSD platforms Date: Wed, 4 Jan 2023 14:44:18 -0800 Message-Id: <20230104224418.77144-1-nathan@brainwerk.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Seq: 51276 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: On OpenBSD, "diff -urpN dir1/ di" would refuse to complete a second filename/directory name. This was caused by the -u and -U options getting dropped from args (overwriting args vs appending). In addition: - Fully build up $of before utilizing it to avoid inconsistent behavior in the treatment of mutually exclusive output formats. - Remove the "-l" option for OpenBSD (this flag was removed in 2015). - Mark the "-x" option as being repeatable on OpenBSD --- Completion/Unix/Type/_diff_options | 41 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/Completion/Unix/Type/_diff_options b/Completion/Unix/Type/_diff_options index dfa9889f2..2646527df 100644 --- a/Completion/Unix/Type/_diff_options +++ b/Completion/Unix/Type/_diff_options @@ -133,33 +133,44 @@ else case $OSTYPE in openbsd*|solaris2.<9->) of+=' -u -U' + ;| + openbsd*|solaris*) + of+=' -n -C -D' + ;| + solaris*) + of+=' -h' + ;| + openbsd*) + of+=' -q' + ;| + # modifications to "$of" should be done above this line so that it is + # uniformly defined while constructing $args + openbsd*|solaris2.<9->) args+=( - "($of)-u[output a unified diff]" - "($of)-U+[output a unified diff]:lines of context" + "($of)-u[output a unified diff]" + "($of)-U+[output a unified diff]:lines of context" ) ;| openbsd*|solaris*) args+=( - "($of)-C+[output a context diff]:lines of context" - "($of)-D+[output merged file with preprocessor directives]:preprocessor symbol" - '-i[case insensitive]' - '-l[long output format (paginate with pr(1))]' - '-s[report on identical files]' - '-t[expand tabs in output lines]' + "($of)-C+[output a context diff]:lines of context" + "($of)-D+[output merged file with preprocessor directives]:preprocessor symbol" + '-i[case insensitive]' + '-s[report on identical files]' + '-t[expand tabs in output lines]' ) ;| solaris*) - of+=' -h -n' args+=( - '-w[ignore all white space]' - "($of)-h[do a fast, half-hearted job]" - "($of)-n[output a reversed ed script]" + '-w[ignore all white space]' + "($of)-h[do a fast, half-hearted job]" + "($of)-n[output a reversed ed script]" '-S+[set first file in comparison]:start with file:_files' + '-l[long output format (paginate with pr(1))]' ) ;; openbsd*) - of+=' -n -q -u -C -D -U' - args=( + args+=( "($of)-n[output an rcsdiff(1)-compatible diff]" "($of)-q[only print a line when the files differ; does not produce a list of changes]" '-a[treat all files as ASCII text]' @@ -173,7 +184,7 @@ else '-P[treat absent files in the second directory as if they were empty]' '-S[start a directory diff from a file name]:file name:_files' '*-X[exclude files and subdirectories whose basenames match lines in a file]:file name:_files' - '-x[exclude files and subdirectories whose basenames match a pattern]:pattern' + '*-x[exclude files and subdirectories whose basenames match a pattern]:pattern' ) ;; esac -- 2.37.3