Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] _xargs: add many options



This is a first pass at adding a lot of options that aren't present in 
xargs completion.  Two questions, after which I'll rework this.

1. I suspect a lot of these are GNU-specific.  Can someone point me to a 
good example of the use of _variant (sp?) for another command that has 
both GNU- and non-GNU completion?

2. The old parameters passed to _arguments were mainly of the form:

   '(-mutually_exclusive)-option:some help text:' \

I changed it so that the help text shows up...

   '(-mutually_exclusive)-option[some help text]::' \

but maybe I'm doing something wrong?  What's the expected difference in 
behavior between an optspec of:

-optname[explanation]::

vs.

-optname:message:

?

Best,
Ben

---
 Completion/Unix/Command/_xargs |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/Completion/Unix/Command/_xargs b/Completion/Unix/Command/_xargs
index f727ed8..905aaba 100644
--- a/Completion/Unix/Command/_xargs
+++ b/Completion/Unix/Command/_xargs
@@ -1,15 +1,19 @@
 #compdef xargs
 
 _arguments \
-  '(-t)-p[prompt user for each command]' \
-  '(-p)-t[verbose - echo each command]' \
-  '-x[exit if max size exceeded]' \
-  -{e-,E}':end-of-file string:' \
-  '(-x -I)-i-:replacement string for lines:' \
-  '(-x -i)-I:replacement string for lines:' \
-  '(-n -L -x)-l-:number of input lines:' \
-  '(-n -l)-L:number of input lines:' \
-  '(-l -L)-n-:maximum number of arguments:' \
-  '-s-:maximum command line length:' \
+  '(-t --verbose)'{-p,--interactive}'[prompt user for each command]' \
+  '(-p --interactive)'{-t,--verbose}'[verbose - echo each command]' \
+  {-x,--exit}'[exit if max size exceeded]' \
+  -{e-,E,-eof}'[end-of-file string]::' \
+  '(-x -I)-i-[replacement string for lines]::' \
+  '(-x -i)-I[replacement string for lines]::' \
+  '(-n -L -x)-l-[number of input lines]::' \
+  '(-n -l)-L[number of input lines]::' \
+  '(-l -L)'{-n-,--max-args}'[maximum number of arguments]::' \
+  {-s-,--max-chars}'[maximum command line length]::' \
+  {-P-,--max-procs}'[maximum simultaneous processes]::' \
+  '(-0 --null)'{-d-,--delimiter}'[terminate input items on the specified delimiter]::' \
+  '(-d --delimiter)'{-0,--null}'[terminate input items on a null character]::' \
+  {-r,--no-run-if-empty}'[do not run if there are no items]' \
   '(-):command: _command_names -e' \
   '*::args: _normal'
-- 
1.7.0



Messages sorted by: Reverse Date, Date, Thread, Author