Closed dvv closed 12 years ago
yup! we have an issue open for this, thanks man
doh! I thought this was commander.js haha... my bad
@visionmedia Hehe, that's what you get for making an awesome library twice ;)
@dvv I believe we actually already support '--' because it's built into the OptionParser library on which commander is based.
Here's an example program to demonstrate:
#!/usr/bin/env ruby
require 'rubygems'
require 'commander/import'
program :version, '0.1'
program :description, 'Test'
command :foo do |c|
c.syntax = 'Test foo [options]'
c.option '-x', 'Switch'
c.action do |args, options|
say "Arguments:"
say args.inspect
say "Options:"
say options.inspect
end
end
And the results of calling it with/without a double-dash argument:
$ ruby test.rb foo -x
Arguments:
[]
Options:
<Commander::Command::Options x=true>
$ ruby test.rb foo -- -x
Arguments:
["-x"]
Options:
<Commander::Command::Options >
So it seems like it behaves as expected. If you're seeing an issue using the double-dash, please provide example code that triggers the problem so we can diagnose.
Thanks!
Hehe. Indeed, it should go to visionmedia/commander.js
@dvv just added this to commander.js
Hi!
Please, consider supporting '--'. Any stuff after '--' should go to arguments, even if it looks like an option
TIA, --Vladimir