8000 At least one positional argument is required to properly raise an error for unknown optional arguments. · Issue #13 · p-ranav/structopt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

At least one positional argument is required to properly raise an error for unknown optional arguments. #13

New issue

Have a question about this project? Sign up f 8000 or 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

Closed
agoessling opened this issue Nov 26, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@agoessling
Copy link

If you only have optional arguments in the structure no error will be produced when unknown optional or positional arguments are provided.

struct Options {
  std::optional<std::string> directory;
};
STRUCTOPT(Options, directory);

Executing ./a.out --bad or ./a.out bad will not raise an exception. If you add a positional argument, you will get the expected result.

struct Options {
  std::optional<std::string> directory;
  std::string dummy;
};
STRUCTOPT(Options, directory, dummy);
@p-ranav p-ranav added the bug Something isn't working label Nov 26, 2020
@p-ranav p-ranav self-assigned this Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
0