zsh-workers
 help / color / mirror / code / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: [PATCH] _diff_options: support macOS Ventura or newer
Date: Fri, 16 Feb 2024 14:05:50 +0900	[thread overview]
Message-ID: <A7575D84-8953-448E-8357-3B033F40010C@kba.biglobe.ne.jp> (raw)

macOS was using diff from GNU diffutils, but Apple has replaced it
(in macOS Ventura, darwin22) with the one based on the FreeBSD version.
It has one Apple-specific option (-A/--algorithm).

The option --color is supported by all of gnu/freebsd/darwin.


diff --git a/Completion/Unix/Type/_diff_options b/Completion/Unix/Type/_diff_options
index 45b777dfe..03ea1d7fe 100644
--- a/Completion/Unix/Type/_diff_options
+++ b/Completion/Unix/Type/_diff_options
@@ -25,7 +25,8 @@ _diff_palette() {
   return ret
 }
 
-if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12->.* ]]; then
+if _pick_variant -r variant -c $cmd gnu=GNU unix -v ||
+  [[ $OSTYPE = (freebsd<12->|darwin<22->).* ]]; then
   (( $#words > 2 )) && ign='!'
 
   # output formats
@@ -73,15 +74,18 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12->
       "($ofwl $ouc $oss)--unchanged-line-format=[set unchanged line format]:unchanged line format"
       '(--to-file)--from-file=[compare specified file to all operands]:from file:_files'
       '(--from-file)--to-file=[compare all operands to specified file]:to file:_files'
-      '--color=-[use colors in output]::when [auto]:(never always auto)'
       '--palette=[specify colors to use]:color:_diff_palette'
       "${ign}(1 2)-v[display version information]"
     )
   else
     args+=( '!--speed-large-files' )
+    if [[ $OSTYPE = darwin<22->.* ]]; then
+      args+=( '(-A --algorithm)'{-A+,--algorithm=}'[specify the algorithm to use]:algorithm:(myers patience stone)' )
+    fi
   fi
 
   _arguments -s $args \
+    '--color=-[use colors in output]::when [auto]:(never always auto)' \
     '(-i --ignore-case)'{-i,--ignore-case}'[case insensitive]' \
     '--ignore-file-name-case[ignore case when comparing file names]' \
     '!(--ignore-file-name-case)--no-ignore-file-name-case' \





                 reply	other threads:[~2024-02-16  5:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A7575D84-8953-448E-8357-3B033F40010C@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).