[Ruby 1.9-Bug#4152][Open] optparseのzsh compsysでrspecの補完が出来ない

Bug #4152: optparseのzsh compsysでrspecの補完が出来ない
http://redmine.ruby-lang.org/issues/show/4152

起票者: Kazuhiro NISHIYAMA
ステータス: Open, 優先度: Normal
ruby -v: ruby 1.9.3dev (2010-12-12 trunk 30182) [x86_64-linux]

説明部分のエスケープが足りていなくて、補完が出来ないコマンドがあります。

% rspec-trunk [TAB]
_arguments:comparguments:303: invalid option definition: -f[Choose a
formatter [p]rogress (default - dots) [d]ocumentation (group and
example names) [h]tml [t]extmate custom formatter class name]
% rspec-trunk --help
Usage: rspec [options] [files or directories]
-b, --backtrace Enable full backtrace
-c, --[no-]color, --[no-]colour Enable color in the output
-d, --debug Enable debugging
-e, --example PATTERN Run examples whose full
descriptions match this pattern
(PATTERN is compiled into a Ruby
regular expression)
-f, --format FORMATTER Choose a formatter
[p]rogress (default - dots)
[d]ocumentation (group and
example names)
[h]tml
[t]extmate
custom formatter class name
-o, --out FILE output to a file instead of STDOUT
-I DIRECTORY specify $LOAD_PATH directory (may
be used more than once)
-l, --line_number LINE Specify the line number of a single
example to run
-p, --profile Enable profiling of examples with
output of the top 10 slowest examples
-r, --require PATH Require a file
-v, --version Show version
-X, --drb Run examples via DRb
–configure COMMAND Generate configuration files
–drb-port [PORT] Port to connect to on the DRb
server
–tty
–fail-fast Use the fail_fast option to tell
RSpec to abort the run on first failure.
-t, --tag TAG[:VALUE] Run examples with the specified tag
To exclude examples, add ~ before
the tag (e.g. ~slow)
(TAG is always converted to a
symbol)
-h, --help You’re looking at it.
% rspec-trunk --version
2.2.1
%

チケット #4152 が更新されました。 (by Yui NARUSE)

ステータス OpenからAssignedに変更
担当者 Kazuhiro NISHIYAMAにセット

コミットしてください

チケット #4152 が更新されました。 (by Kazuhiro NISHIYAMA)

[p] などを [p] のようにエスケープすれば良いようです。

% cat ~/.zsh.d/Completion/_rspec-trunk
#compdef rspec-trunk

typeset -A opt_args
local context state line

_arguments -s -S
“-b[Enable full backtrace]”
“–backtrace[Enable full backtrace]”
“-c[Enable color in the output]”
“–color[Enable color in the output]”
“–no-color[Enable color in the output]”
“–colour[Enable color in the output]”
“–no-colour[Enable color in the output]”
“-d[Enable debugging]”
“–debug[Enable debugging]”
“-e[Run examples whose full descriptions match this pattern(PATTERN is
compiled into a Ruby regular expression)]”
“–example[Run examples whose full descriptions match this
pattern(PATTERN is compiled into a Ruby regular expression)]”
“-f[Choose a formatter [p]rogress (default - dots) [d]ocumentation
(group and example names) [h]tml [t]extmate custom formatter class
name]”
“–format[Choose a formatter [p]rogress (default - dots)
[d]ocumentation (group and example names) [h]tml [t]extmate custom
formatter class name]”
“-o[output to a file instead of STDOUT]”
“–out[output to a file instead of STDOUT]”
“-I[specify $LOAD_PATH directory (may be used more than once)]”
“-l[Specify the line number of a single example to run]”
“–line_number[Specify the line number of a single example to run]”
“-p[Enable profiling of examples with output of the top 10 slowest
examples]”
“–profile[Enable profiling of examples with output of the top 10
slowest examples]”
“-r[Require a file]”
“–require[Require a file]”
“-v[Show version]”
“–version[Show version]”
“-X[Run examples via DRb]”
“–drb[Run examples via DRb]”
“–configure[Generate configuration files]”
“–drb-port[Port to connect to on the DRb server]”
“–tty[]”
“–fail-fast[Use the fail_fast option to tell RSpec to abort the run
on first failure.]”
“-t[Run examples with the specified tagTo exclude examples, add ~
before the tag (e.g. ~slow)(TAG is always converted to a symbol)]”
“–tag[Run examples with the specified tagTo exclude examples, add ~
before the tag (e.g. ~slow)(TAG is always converted to a symbol)]”
“-h[You’re looking at it.]”
“–help[You’re looking at it.]”
‘*:file:_files’ && return 0
% vi ~/.zsh.d/Completion/_rspec-trunk
[p] などを [p] のようにエスケープ
% cat ~/.zsh.d/Completion/_rspec-trunk
#compdef rspec-trunk

typeset -A opt_args
local context state line

_arguments -s -S
“-b[Enable full backtrace]”
“–backtrace[Enable full backtrace]”
“-c[Enable color in the output]”
“–color[Enable color in the output]”
“–no-color[Enable color in the output]”
“–colour[Enable color in the output]”
“–no-colour[Enable color in the output]”
“-d[Enable debugging]”
“–debug[Enable debugging]”
“-e[Run examples whose full descriptions match this pattern(PATTERN is
compiled into a Ruby regular expression)]”
“–example[Run examples whose full descriptions match this
pattern(PATTERN is compiled into a Ruby regular expression)]”
“-f[Choose a formatter [p]rogress (default - dots)
[d]ocumentation (group and example names) [h]tml [t]extmate
custom formatter class name]”
“–format[Choose a formatter [p]rogress (default - dots)
[d]ocumentation (group and example names) [h]tml [t]extmate
custom formatter class name]”
“-o[output to a file instead of STDOUT]”
“–out[output to a file instead of STDOUT]”
“-I[specify $LOAD_PATH directory (may be used more than once)]”
“-l[Specify the line number of a single example to run]”
“–line_number[Specify the line number of a single example to run]”
“-p[Enable profiling of examples with output of the top 10 slowest
examples]”
“–profile[Enable profiling of examples with output of the top 10
slowest examples]”
“-r[Require a file]”
“–require[Require a file]”
“-v[Show version]”
“–version[Show version]”
“-X[Run examples via DRb]”
“–drb[Run examples via DRb]”
“–configure[Generate configuration files]”
“–drb-port[Port to connect to on the DRb server]”
“–tty[]”
“–fail-fast[Use the fail_fast option to tell RSpec to abort the run
on first failure.]”
“-t[Run examples with the specified tagTo exclude examples, add ~
before the tag (e.g. ~slow)(TAG is always converted to a symbol)]”
“–tag[Run examples with the specified tagTo exclude examples, add ~
before the tag (e.g. ~slow)(TAG is always converted to a symbol)]”
“-h[You’re looking at it.]”
“–help[You’re looking at it.]”
‘*:file:_files’ && return 0
% unfunction _rspec-trunk
% autoload -U _rspec-trunk
% rspec-trunk -[TAB]
option
–backtrace -b – Enable full backtrace
–configure – Generate configuration files
–debug -d – Enable debugging
–drb -X – Run examples via DRb
–drb-port – Port to connect to on the DRb
server
–example -e – Run examples whose full
descriptions
–fail-fast – Use the fail_fast option to
tell RSpe
–format -f – Choose a formatter [p]rogress
(defau
–help -h – You’re looking at it.
–line_number -l – Specify the line number of a
single e
–no-color --colour --color -c
–no-colour – Enable color in the output
–out -o – output to a file instead of
STDOUT
–profile -p – Enable profiling of examples
with out
–require -r – Require a file
–tag -t – Run examples with the specified
tagTo
–tty –
–version -v – Show version
-I – specify directory (may be used
more

チケット #4152 が更新されました。 (by Anonymous)

ステータス AssignedからClosedに変更
進捗 % 0から100に変更

This issue was solved with changeset r30394.
Kazuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.