We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
timosesu reported this on 2018-12-11T16:30:09Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=19478
Description
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);The text was updated successfully, but these errors were encountered: