← Back to index
|
Original Bugzilla link
Bug 19478 – getopt with config.stopOnFirstNonOption fails to recognize option
Status
NEW
Severity
minor
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2018-12-11T16:30:09Z
Last change time
2024-12-01T16:34:37Z
Assigned to
No Owner
Creator
Timoses
Moved to GitHub: phobos#10362 →
Comments
Comment #0
by timosesu — 2018-12-11T16:30:09Z
std.getopt seems to fail when reversing the order of the options passed as args when config.stopOnFirstNonOption is enabled. string dir1; string dir2; string[] args = ["./app", "--dir1", "dir1","--dir2", "dir2"]; auto result = getopt(args, config.stopOnFirstNonOption, "dir1", "first dir", &dir1, "dir2", "second dir", &dir2); assert(dir1 == "dir1" && dir2 == "dir2"); args = ["./app", "--dir2", "dir2","--dir1", "dir1"]; // No problem without 'config.stopOnFirstNonOption' result = getopt(args, "dir1", "first dir", &dir1, "dir2", "second dir", &dir2); assert(dir1 == "dir1" && dir2 == "dir2"); args = ["./app", "--dir2", "dir2","--dir1", "dir1"]; // Throws: "Unrecognized option --dir1" result = getopt(args, config.stopOnFirstNonOption, "dir1", "first dir", &dir1, "dir2", "second dir", &dir2);
Comment #1
by robert.schadek — 2024-12-01T16:34:37Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/phobos/issues/10362
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB