Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: new diff3 completion
- X-seq: zsh-workers 43329
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: new diff3 completion
- Date: Fri, 24 Aug 2018 07:54:20 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1535090062; bh=erVBW4kKToF/08Rbrmo0ubWlLyjGH+/eJMcE4O0xTWM=; h=From:To:Subject:Date:From:Subject; b=DCgPojmsWJGaQUrESY8Fn8BG+IN7r/lDSOiw7X7PphmmeMytZN3HFJWAeEhqt1+VV/cYckMLOtKSRvsDjx+OGuJ63bdg2Q5M/sKZjRLwzVAE3DNiAEJiE/l9C97Nhc5STA8KbNlTkzouUIog+ubuV4ojk2uBCdtRvH4rOzoiv0bzjdKqyNHMFUi5URpDOFXSxrPcMkpG6t2KcEUIMypZqfsOBOxEtICcTfNz++pO1UHwJlQUOlup3YcA9tpDHTIaiNnT+WPTSK+XAD3dLCcu/Ue2kC+G+c30/nhBU9Wmeo7N/F4k8/Z9ZVUo8bNbl9uiyXuQdchO/gjLivZgsgDFNw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
+
Messages sorted by:
Reverse Date,
Date,
Thread,
Author