New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 9583 #1159
Fix issue 9583 #1159
Conversation
if (endOfOptions.length && a == endOfOptions) | ||
{ | ||
// Consume the "--" | ||
args = args[0 .. i + 1] ~ args[i + 2 .. $]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args = args.remove(i + 1);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yah
Link to issue: http://d.puremagic.com/issues/show_bug.cgi?id=9583 |
LGTM other than @AndrejMitrovic's comment. |
cc @andralex |
Done. |
Hmm.. The loop is |
Generally, I wouldn't do it, but in this case, we're breaking immediately, so I think it should be OK. (In the case of arrays, though, I think foreach actually iterates over a slice, so it should be safe -- modifying args will reallocate anyway so it won't stomp on what the loop is doing.) |
|
Oops, you're right. Well, but I think in this case it should be OK, because we're breaking immediately. Unless you think it's better to rewrite the loop to prevent possible future breakage? |
It should be ok since we're breaking. Anyway this pull is LGTM. |
As stated by the docs. (Cf. issue 9583)
Rebased. |
std.getopt.getopt should consume options terminator "--" as claimed by docs