Bug 13316 – std.getopt: implicit help option breaks the next argument

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-08-17T22:28:00Z
Last change time
2014-08-18T16:51:59Z
Keywords
pull
Assigned to
nobody
Creator
nilsbossung

Comments

Comment #0 by nilsbossung — 2014-08-17T22:28:32Z
--- cat > test1.d << code import std.getopt; void main() { string[] args = ["program", "--help", "--", "something"]; getopt(args, config.passThrough /* because of issue 13315 */); assert(args == ["program", "something"]); } code dmd test1.d ./test1 --- [email protected](6): Assertion failure --- --- cat > test2.d << code import std.getopt; void main() { string[] args = ["program", "--help", "--"]; getopt(args, config.passThrough /* because of issue 13315 */); assert(args == ["program"]); } code dmd test2.d ./test2 --- core.exception.AssertError@/home/nils/d/dmd/dmd2/linux/bin64/../../src/phobos/std/range.d(4153): range is smaller than amount of items to pop --- When issue 13315 is fixed, this should be tested, too: --- cat > test3.d << code import std.getopt; void main() { bool b; string[] args = ["program", "--help", "nonoption", "--option"]; getopt(args, config.stopOnFirstNonOption, "option", &b); assert(args == ["program", "nonoption", "--option"]); } code dmd test3.d ./test3 --- Going to add the fix for this to the pull request I opened for 13315: https://github.com/D-Programming-Language/phobos/pull/2433
Comment #1 by github-bugzilla — 2014-08-18T16:51:56Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/9c10c242205fc94071de2676c8e2409843e3c81a fix Issue 13316 - std.getopt: implicit help option breaks the next argument https://github.com/D-Programming-Language/phobos/commit/a2b4b0eadede01836cab4f3418131d6095ae9c4c Merge pull request #2433 from NilsBossung/13315 fix issues 13315, 13316, 13317 - std.getopt woes