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

Re: PATCH: Completion/User/_cvs again.



On Sep 7,  7:47pm, Tanaka Akira wrote:
> 
> I changed `_cvs' a bit. This change just its style

As long as we're talking style, why do with a `case` what you can do with
substitution?  I think the following is a lot more easily maintained, if
maybe a bit less readable ...

Index: Completion/User/_cvs
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.1/Completion/User/_cvs,v
retrieving revision 1.15
diff -u -r1.15 _cvs
--- _cvs	1999/09/07 21:43:55	1.15
+++ _cvs	1999/09/07 22:23:19
@@ -35,34 +35,8 @@
   if (( CURRENT == 1 )); then
     compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds}
   else
-    case "${${(k)cmds[(R)* $words[1] *]}:-$words[1]}" in
-      add) _cvs_add;;
-      admin) _cvs_admin;;
-      annotate) _cvs_annotate;;
-      checkout) _cvs_checkout;;
-      commit) _cvs_commit;;
-      diff) _cvs_diff;;
-      edit) _cvs_edit;;
-      editors) _cvs_editors;;
-      export) _cvs_export;;
-      history) _cvs_history;;
-      import) _cvs_import;;
-      init) _cvs_init;;
-      log) _cvs_log;;
-      login) _cvs_login;;
-      logout) _cvs_logout;;
-      rdiff) _cvs_rdiff;;
-      release) _cvs_release;;
-      remove) _cvs_remove;;
-      status) _cvs_status;;
-      rtag) _cvs_rtag;;
-      tag) _cvs_tag;;
-      unedit) _cvs_unedit;;
-      update) _cvs_update;;
-      watch) _cvs_watch;;
-      watchers) _cvs_watchers;;
-      *) _message "unknown cvs command: $words[1]";;
-    esac
+    _cvs_"${${(k)cmds[(R)* $words[1] *]}:-$words[1]}" 2>&- ||
+      _message "unknown cvs command: $words[1]"
   fi
 }
 



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