doesn't ignore arguments after -- #115

Closed
rosenfeld opened this Issue Jun 5, 2012 · 5 comments

Comments

Projects
None yet
3 participants
rake some_task -- some_arg

Raises an error after running some_task:

Don't know how to build task some_arg.
Collaborator

drbrain commented Jun 13, 2012

Rake processes arguments first, obeying --.

Then rake discovers task names and env-style rake arguments.

If you use some_arg= it will be treated as an argument.

Otherwise task names after -- will be treated as task names.

@jimweirich will have to decide if he wants to change the behavior of rake, but it will be difficult to implement since rake does not know where -- appeared.

I'm not sure if it doesn't know. If you try to use some option after --, like --anything=any, rake won't complain, but if you try to include some unsupported option before the -- it will complain about an unsupported option.

Collaborator

drbrain commented Jun 14, 2012

$ ruby -roptparse -e 'p ARGV; OptionParser.new.parse! ARGV; p ARGV' -- foo -- bar
["foo", "--", "bar"]
["foo", "bar"]

So it would be just a matter of popping out all extra arguments from ARGV after '--' to a separate array before passing it to OptionParser, right?

Owner

jimweirich commented Oct 18, 2012

There is no expectation for rake to ignore arguments after a "--".

In fact, there is currently a proposal to use "--" as an argument/option separator.

In light of that, I'm not changing the behavior of rake w.r.t. -- for the time being.

@jimweirich jimweirich closed this Oct 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment