-
Notifications
You must be signed in to change notification settings - Fork 148
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
Parameter flagged as missing even though it appears #5
Comments
Hi. BTW: I saw that you enclosed the parsing in a try/catch block. I'm curious: Is that because you are just beeing careful? The only exceptions that could be thrown are those escaping from std library calls (like std::bad_alloc). I don't throw explicitly in clipp, because I don't want to require exception handling (some people need to compile without it). |
The try / catch is because, in the longer-form version of this code, I actually have some callbacks that can throw exceptions (e.g. to create a directory if it doesn't exist, which might throw if the user doesn't have permission etc.). I'm not operating in any scenario where I can't afford exceptions. The main software we work on is high-performance genomics software run on mostly linux and osx x86-64 servers. |
Any thoughts on this? I took a brief look over the code, but don't think I grok the basic design well enough to diagnose the error. |
I have the same kind of problem. Here is an example: #include <iostream>
#include <clipp.h>
int main(int argc, char *argv[]) {
std::string seed;
std::string prog;
auto cli = (
clipp::option("-s", "--seed").doc("set the seed value") & clipp::value("seed", seed),
clipp::value("player", prog)
);
auto res = parse(argc, argv, cli);
if(!res) {
clipp::debug::print(std::cerr, res);
std::cerr << clipp::make_man_page(cli, argv[0]) << '\n';
return -1;
}
std::cout << "Seed: " << seed << '\n';
std::cout << "Player: " << prog << '\n';
return 0;
} And the result:
Adding a point in the last argument makes the parser crazy. |
I was quite busy the past few days and traveled a lot. I should find the time to get it fixed in the next days (both the requirement bug and the one with the point). |
OK, fixed the bug with parameters starting with |
Cool! It looks like the fix has not been pushed yet, right? (or are you just waiting until both are fixed?) |
I pushed the fix. |
Ah crap. I missed some cases where it is still not working correctly... |
So - finally did it. Fixing the first bug uncovered another one. Both should be fixed by now. |
Awesome! The newest release definitely solves the specific issue I posted, so I'll update my version of clipp across my projects currently using it. Thanks! |
Hi. I get the following behavior using the latest version of clipp. The issue seems to be that the required options are only properly parsed if they appear in a certain order. Consider the following small test program:
When I pass all of the required options as follows, the parser fails. All of the options do look to have the appropriate associated value, but the "gfa_file" option is marked as missing even though it is clearly present.
Strangely, if I simply change the order of the named options, everything works as expected:
Presumably, both of these invocations should be equivalent. Any idea why the former is failing?
Thanks!
Rob
[Edit: In case it's helpful, I found the function you have to print the parsing results in the
debug
namespace. Here is what it gives with the example that fails]The text was updated successfully, but these errors were encountered: