Skip to content
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

choices() with a single string literal does not work #90

Open
mknejp opened this issue Jun 3, 2024 · 0 comments
Open

choices() with a single string literal does not work #90

mknejp opened this issue Jun 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mknejp
Copy link

mknejp commented Jun 3, 2024

When calling choices("foo") it appears the array overload is preferred, leading to the value not being accepted.

auto choice = std::string{};
cli.add_argument(
  lyra::opt(choice, "your choice")
    .name("--choice")
    .choices("foo")                // does not work
    //.choices(std::string{"foo"}) // does work
    .required());

When called with ./a.out --choice foo it causes the error Unable to convert 'foo' to destination type

Demonstration: https://godbolt.org/z/YWvY3a96x

@grafikrobot grafikrobot added the bug Something isn't working label Sep 23, 2024
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
Status: 🔖 Ready
Development

No branches or pull requests

2 participants