zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: new rake completion
@ 2005-07-11 18:10 Doug Kearns
  2005-07-12  6:05 ` Doug Kearns
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Kearns @ 2005-07-11 18:10 UTC (permalink / raw)
  To: zsh-workers

Here's a start on rake completion...

Regards,
Doug

Index: Completion/Unix/Command/_rake
===================================================================
RCS file: Completion/Unix/Command/_rake
diff -N Completion/Unix/Command/_rake
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_rake	11 Jul 2005 18:10:52 -0000
@@ -0,0 +1,42 @@
+#compdef rake
+
+# rake, version 0.5.4
+
+local curcontext="$curcontext" state line ret=1
+typeset -A opt_args
+
+_arguments -C \
+  '(--dry-run -n)'{--dry-run,-n}'[do a dry run without executing actions]' \
+  '(- *)'{--help,-H}'[display help information]' \
+  '(--libdir -I)'{--libdir,-I}'[include specified directory in the search path for required modules]:library directory:_files -/' \
+  '(--nosearch -N)'{--nosearch,-N}'[do not search parent directories for the Rakefile]' \
+  '(--prereqs -P)'{--prereqs,-P}'[display the tasks and prerequisites, then exit]' \
+  '(--quiet -q --silent -s)'{--quiet,-q}'[do not log messages to standard output]' \
+  '(--rakefile -f)'{--rakefile,-f}'[use specified file as the rakefile]:rake file:_files' \
+  '(--require -r)'{--require,-r}'[require specified module before executing rakefile]' \
+  '(--silent -s --quiet -q)'{--silent,-s}"[like --quiet, but also suppresses the 'in directory' announcement]" \
+  '(--tasks -T)'{--tasks,-T}'[display the tasks and dependencies, then exit]' \
+  '(--trace -t)'{--trace,-t}'[turn on invoke/execute tracing, enable full backtrace]' \
+  '(--usage -h)'{--usage,-h}'[display usage information]' \
+  '(--verbose -v)'{--verbose,-v}'[log message to standard output (default)]' \
+  '(- *)'{--version,-V}'[display version information]' \
+  '*:target:->target' && ret=0
+
+case "$state" in
+  library)
+    local -a dirs
+    dirs=( $(_call_program directories ruby -e 'puts\ $:' 2>/dev/null) )
+    _wanted libraries expl library _path_files -W dirs && ret=0
+  ;;
+  target)
+    local -a targets
+    targets=( ${${(f)"$(_call_program targets $words[1] -sT 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/$match[1]:${match[2]:l}} )
+    if (( ! ${targets[(I)rake aborted!]} )) then
+      _describe -t targets 'rake target' targets && ret=0
+    else
+      _message -e targets 'rake target'
+    fi
+  ;;
+esac
+
+return ret


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: new rake completion
  2005-07-11 18:10 PATCH: new rake completion Doug Kearns
@ 2005-07-12  6:05 ` Doug Kearns
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Kearns @ 2005-07-12  6:05 UTC (permalink / raw)
  To: zsh-workers

On Tue, Jul 12, 2005 at 04:10:45AM +1000, Doug Kearns wrote:
> Here's a start on rake completion...

Mostly complete now...
 
Regards,
Doug

Index: Completion/Unix/Command/_rake
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_rake,v
retrieving revision 1.1
diff -u -r1.1 _rake
--- Completion/Unix/Command/_rake	11 Jul 2005 18:33:02 -0000	1.1
+++ Completion/Unix/Command/_rake	12 Jul 2005 06:08:13 -0000
@@ -5,32 +5,32 @@
 local curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 
-_arguments -C \
+_arguments -C -S \
   '(--dry-run -n)'{--dry-run,-n}'[do a dry run without executing actions]' \
   '(- *)'{--help,-H}'[display help information]' \
-  '(--libdir -I)'{--libdir,-I}'[include specified directory in the search path for required modules]:library directory:_files -/' \
+  \*{--libdir,-I}'[include specified directory in the search path for required modules]:library directory:_files -/' \
   '(--nosearch -N)'{--nosearch,-N}'[do not search parent directories for the Rakefile]' \
-  '(--prereqs -P)'{--prereqs,-P}'[display the tasks and prerequisites, then exit]' \
-  '(--quiet -q --silent -s)'{--quiet,-q}'[do not log messages to standard output]' \
+  '(- *)'{--prereqs,-P}'[display the tasks and prerequisites, then exit]' \
+  '(--quiet -q --silent -s --verbose -v)'{--quiet,-q}'[do not log messages to standard output]' \
   '(--rakefile -f)'{--rakefile,-f}'[use specified file as the rakefile]:rake file:_files' \
-  '(--require -r)'{--require,-r}'[require specified module before executing rakefile]' \
-  '(--silent -s --quiet -q)'{--silent,-s}"[like --quiet, but also suppresses the 'in directory' announcement]" \
-  '(--tasks -T)'{--tasks,-T}'[display the tasks and dependencies, then exit]' \
+  \*{--require,-r}'[require specified module before executing rakefile]:library:->library' \
+  '(--quiet -q --silent -s --verbose -v)'{--silent,-s}"[like --quiet, but also suppresses the 'in directory' announcement]" \
+  '(- *)'{--tasks,-T}'[display the tasks and dependencies, then exit]' \
   '(--trace -t)'{--trace,-t}'[turn on invoke/execute tracing, enable full backtrace]' \
-  '(--usage -h)'{--usage,-h}'[display usage information]' \
-  '(--verbose -v)'{--verbose,-v}'[log message to standard output (default)]' \
+  '(- *)'{--usage,-h}'[display usage information]' \
+  '(--quiet -q --silent -s --verbose -v)'{--verbose,-v}'[log message to standard output (default)]' \
   '(- *)'{--version,-V}'[display version information]' \
   '*:target:->target' && ret=0
 
 case "$state" in
   library)
     local -a dirs
-    dirs=( $(_call_program directories ruby -e 'puts\ $:' 2>/dev/null) )
+    dirs=( $(_call_program directories ruby -e 'puts\ $:' 2>/dev/null) ${(s.:.)opt_args[-I]} )
     _wanted libraries expl library _path_files -W dirs && ret=0
   ;;
   target)
     local -a targets
-    targets=( ${${(f)"$(_call_program targets $words[1] -sT 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/$match[1]:${match[2]:l}} )
+    targets=( ${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/$match[1]:${match[2]:l}} )
     if (( ! ${targets[(I)rake aborted!]} )) then
       _describe -t targets 'rake target' targets && ret=0
     else


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-12  6:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-11 18:10 PATCH: new rake completion Doug Kearns
2005-07-12  6:05 ` Doug Kearns

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).