From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15172 invoked from network); 1 Jun 2001 05:30:57 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Jun 2001 05:30:57 -0000 Received: (qmail 25020 invoked by alias); 1 Jun 2001 05:30:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14628 Received: (qmail 25005 invoked from network); 1 Jun 2001 05:30:46 -0000 To: zsh-workers@sunsite.dk Subject: completion function for Ruby and exclusion list problem. MIME-Version: 1.0 (generated by SEMI 1.14.0 - "Iburihashi") Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 01 Jun 2001 14:30:42 +0900 Message-ID: User-Agent: T-gnus/6.14.5 (based on Gnus v5.8.7) (revision 08) SEMI/1.14.0 (Iburihashi) Deisui/1.14.0 (Kikuhime) APEL/10.2 Emacs/21.0.103 (i386-unknown-freebsd4.2) MULE/5.0 (SAKAKI) I wrote a completion function for Ruby - scripting language like Perl or Python. It almost works, but I found a problem with exclusion list. Z(3):akr@flux% Src/zsh -f flux% fpath=(Completion Completion/**/*(/)); bindkey -e; autoload -U compinit; compinit -D flux% zstyle '*' group-name '' flux% zstyle '*:messages' format '%d' flux% zstyle '*:descriptions' format '%d' flux% compdef _tst tst flux% _tst () { function> _arguments '(1)-x' ':a:' ':b:' function> } flux% tst -x a I think it should show `b' instead of `a' because non-option first argument is excluded by `-x'. Index: Completion/Unix/Command/_ruby =================================================================== RCS file: _ruby diff -N _ruby --- /dev/null Thu May 24 22:33:05 2001 +++ _ruby Thu May 31 22:22:07 2001 @@ -0,0 +1,49 @@ +#compdef ruby + +# completion function for Ruby. +# http://www.ruby-lang.org/ + +local expl curcontext="$curcontext" line state +typeset -A opt_args +local dirs + +_arguments -C -s \ + '--version[print version]' \ + '-c[syntax check]' \ + '-w[verbose mode without printing version message at the beginning]' \ + '(-d)--debug[debug mode]' \ + '(--debug)-d[debug mode]' \ + '(-h)--help[print help message]' \ + '(--help)-h[print help message]' \ + '-l[automatic line-ending processing]' \ + '-p[loop and print]' \ + '-n[loop]' \ + '-a[auto-split mode]' \ + '-s[switch parsing]' \ + '-0-[input record separator]:input record separator in octal:' \ + '-K-[specifies KANJI (Japanese) encoding]:KANJI encoding:((e\:EUC-JP s\:Shift_JIS u\:UTF-8 N\:None))' \ + '-F-[input field separator]:input field separator:' \ + '-i-[in-place-edit mode]:suffix for in-place-edit mode:(.bak)' \ + '-I+[library directory]:library directory:_files -/' \ + '-r+[require library]:library name:->library' \ + '-S[search ruby script in PATH]' \ + '(--verbose)-v[verbose mode]' \ + '(-v)--verbose[verbose mode]' \ + '-x-[embedded script]:directory:_files -/' \ + '-C+[chdir]:directory:_files -/' \ + '(--yydebug)-y[compiler debug mode]' \ + '(-y)--yydebug[compiler debug mode]' \ + '--copyright[copyright notice]' \ + '-T-[taint check]:taint level:' \ + '(1)-e+[ruby command]:ruby command:' \ + ':script file:_files' \ + ':script argument:_files' && return 0 + +case $state in + library) + dirs=($(_call_program directories $words[1] -e 'print\ \$:.join\(\"\\n\"\)')) + _wanted directories expl library \ + _path_files -W dirs + ;; +esac + -- Tanaka Akira