zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: PATCH: completion for a few more coreutils things
Date: Tue, 10 Oct 2017 11:16:00 +0200	[thread overview]
Message-ID: <21600.1507626960@thecus.kiddle.eu> (raw)
In-Reply-To: <26A9DD8C-898D-4AF9-B060-B7444CC835DA@kba.biglobe.ne.jp>

Jun T wrote:
> The file Completion/Unix/Command/_expand need be renamed because _expand
> already exists in Completion/Base/Completer/_expand.

Oh yes. That'll break things fairly badly, sorry.

expand and unexpand completion have a few things in common so
perhaps the best is just to roll expand completion into _unexpand.

Oliver

diff --git a/Completion/Unix/Command/_unexpand b/Completion/Unix/Command/_unexpand
index d9793ea70..13f6ce835 100644
--- a/Completion/Unix/Command/_unexpand
+++ b/Completion/Unix/Command/_unexpand
@@ -1,26 +1,33 @@
-#compdef unexpand gunexpand
+#compdef unexpand gunexpand expand gexpand
 
-local all tabs ret=1
+local all tabs
 local -a args
 
 all="convert all whitespace, instead of just initial whitespace"
-tabs="use comma separated list of tab positions"
-args=( 
-  "(--all)-a[$all]"
-  "(--tabs)-t+[$tabs]:tablist"
-  '*:file:_files'
-)
+tabs="[use comma separated list of tab positions]:list of tab positions"
 
 if _pick_variant gnu="Free Soft" unix --version; then
+  if [[ $service = *un* ]]; then
+    args=(
+      "(-a --help --version)--all[$all]"
+      '(--help --version)--first-only[convert only leading sequences of whitespace]'
+    )
+  else
+    args=(
+      '(-i --initial --help --version)'{-i,--initial}"[don't convert tabs after non blanks]"
+    )
+  fi
+
   args+=(
-    "(-a)--all[$all]"
-    '--first-only[convert only leading sequences of whitespace]'
-    "(-t)--tabs=[$tabs]:tablist"
+    "(-t --help --version)--tabs=${tabs}"
     '(* -)--help[display usage information]'
-    '(* -)--version[output version information]'
+    '(* -)--version[display version information]'
   )
+elif [[ $OSTYPE = (*bsd*|dragonfly*|darwin*) ]]; then
+  args=( -A "-*" )
 fi
+[[ $service = *un* ]] && args+=(  "(--all --help --version)-a[$all]" )
 
-_arguments -s -S "$args[@]" && ret=0
-
-return ret
+_arguments -s -S "$args[@]" \
+  "(--tabs --help)-t+${tabs}" \
+  '*:file:_files'


  parent reply	other threads:[~2017-10-10  9:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 22:16 Oliver Kiddle
2017-10-10  6:18 ` Jun T
2017-10-10  8:57   ` Peter Stephenson
2017-10-10  9:16   ` Oliver Kiddle [this message]
2017-10-11  1:23     ` Daniel Shahaf
2017-10-11 16:45       ` Bart Schaefer
2017-10-11 17:56         ` Daniel Shahaf

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=21600.1507626960@thecus.kiddle.eu \
    --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).