zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: new diff3 completion
Date: Fri, 24 Aug 2018 07:54:20 +0200	[thread overview]
Message-ID: <33781-1535090060.665327@G26z.3ukV.SIkh> (raw)

This adds completion for diff3 which was lacking. Apart from openbsd,
the BSDs include the GNU version so this was relatively simple.

Oliver

diff --git a/Completion/Unix/Command/_diff3 b/Completion/Unix/Command/_diff3
new file mode 100644
index 000000000..81e274d05
--- /dev/null
+++ b/Completion/Unix/Command/_diff3
@@ -0,0 +1,46 @@
+#compdef diff3
+
+local -a args ed
+local ign
+
+if _pick_variant gnu=GNU unix; then
+  ed=(
+    '(-m --merge -A --show-all)'{-e,--ed}'[output ed script for incorporating changes]'
+    '(-m --merge -A --show-all)'{-E,--show-overlap}'[like -e, but bracket conflicts]'
+    '(-m --merge -A --show-all)'{-3,--easy-only}'[like -e, but incorporate only nonoverlapping changes]'
+    '(-m --merge -A --show-all)'{-x,--overlap-only}'[like -e, but incorporate only overlapping changes]'
+    '(-m --merge -A --show-all)-X[like -x, but bracket conflicts]'
+  )
+  (( $#words > 2 )) && ign='!'
+  args=(
+    '(-A --show-all ed)'{-A,--show-all}'[output all changes, bracketing conflicts]'
+    "(-m --merge)-i[append 'w' and 'q' commands to ed scripts]"
+    '(-m --merge -i ed)'{-m,--merge}'[output merged file instead of ed script]'
+    '(-a --text)'{-a,--text}'[treat all files as text]'
+    '--strip-trailing-cr[strip trailing carriage return on input]'
+    '(-T --initial-tab)'{-T,--initial-tab}'[make tabs line up by prepending a tab]'
+    '--diff-program=[specify program to compare files]: : _command_names -e'
+    \*{-L+,--label=}'[use specified label instead of file name]:label'
+    "$ign(-)--help[display usage information]"
+    "$ign(-)"{-v,--version}'[display version information]'
+  )
+else
+  args=( -A "-*" )
+  ed=(
+    '-e[output ed script for incorporating changes]'
+    '-E[like -e, but bracket conflicts]'
+    '-x[like -e, but incorporate only overlapping changes]'
+    '-X[like -x, but bracket conflicts]'
+    '-3[like -e, but incorporate only nonoverlapping changes]'
+  )
+  if [[ $OSTYPE != solaris* ]]; then # likely the openbsd diff3 implementation
+    args+=( '-a[treat all files as text]' )
+  fi
+fi
+
+_arguments -s -S $args \
+  '1:updated file:_files' \
+  '2:original file:_files' \
+  '3:updated file:_files' \
+  + '(ed)' $ed
+


                 reply	other threads:[~2018-08-24  5:55 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=33781-1535090060.665327@G26z.3ukV.SIkh \
    --to=okiddle@yahoo.co.uk \
    --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).