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

Re: Completion and surfraw



> Up to now, the only problem is with surfraw: with bash, I used to type:
> 
> % sr [TAB] 
> 
> and I was proposed the elvi list (alioth, altavista, amazon etc.) to
> complete.
> With zsh however, I get the files of the directory I'm in.

Someone has written a completion function for bash, but not for zsh.
Here's a start.  Someone who actually uses surfraw should flesh it out
more.

Index: Completion/Unix/Command/_surfraw
===================================================================
RCS file: Completion/Unix/Command/_surfraw
diff -N Completion/Unix/Command/_surfraw
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_surfraw	21 Apr 2005 23:35:45 -0000
@@ -0,0 +1,15 @@
+#compdef surfraw sr
+
+_arguments \
+   '-browser=[set browser]:browser:_command_names' \
+   '-elvi[list Surfraw mechanisms for conquering evil]' \
+   '-escape-url-args=[apply url escaping to arguments]:bool:(yes no)' \
+   '(-g -graphical)'{-g,-graphical}'[get some windowed sin]' \
+   '-p0rn=[Yes, yes, harder, deeper, faster, oh baybe]:bool:(yes no)' \
+   '-help' \
+   '-quiet:bool:(yes no)' \
+   '-new[start in a new window]' \
+   '(-t -text)'{-t,-text}'[back to the yellow brick road]' \
+   '(-q -quote)'{-q,-quote}'[Quote arguments with quote characters]' \
+   '-version[display Surfraw version]' \
+   ':elvi: compadd ${${(f)"$(surfraw -elvi)"}%%[[:space:]]##--*}'



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