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

program aborts when adding options with short commands longer than 1 char #1111

Open
tigerplush opened this issue Jan 3, 2025 · 1 comment

Comments

@tigerplush
Copy link

I added the option

    uint64_t speciations_per_habitat;
    app.add_option("-sph,--speciations-per-habitat", speciations_per_habitat, "how many events should be simulated before simulation stops")->required();

and it just threw
2025-01-03_10h56_23

I changed it to

    uint64_t speciations_per_habitat;
    app.add_option("-t,--maxt", speciations_per_habitat, "how many events should be simulated before simulation stops")->required();

and now everything works.

having dashes in the long command leads to the long command not beeing recognized. so even if I had kept --speciations-per-habitat, the cli parser would ask for the option even if had added it into the command line

@phlptp
Copy link
Collaborator

phlptp commented Jan 3, 2025

-sph is likely the cause of the problem. That is a non-standard option name. Short options with more than 1 character are not allowed unless you enabled them with .allow_non_standard_option_names() on the app. This was added not that long ago in the code for main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants