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

config_to_str does not work for tuple #550

Closed
pwm1234-sri opened this issue Jan 21, 2021 · 2 comments · Fixed by #661
Closed

config_to_str does not work for tuple #550

pwm1234-sri opened this issue Jan 21, 2021 · 2 comments · Fixed by #661

Comments

@pwm1234-sri
Copy link

I have an option that is a std::tuple<double, double, double, double> type.
When I call App::config_to_str the tuple option is not being written to the config string because its string representation is empty.
I am, however, able to use the option in the config file, so I know the to/from string steps are working everywhere except in config_to_str.

I am using 1.9.0 and I see that 1.9.1 has a string conversion fix, #421, but I do not know if that fix also addresses tuple problems like this.

Thanks for make CLI11 a great library for the rest of us to use! (I have bugged you in the past from account @pwm1234)
Phil

@phlptp
Copy link
Collaborator

phlptp commented Oct 25, 2021

I added a test

std::tuple<double, double,double,double> t;
    app.add_option("--tuple", t);
    app.config_formatter(std::make_shared<CLI::ConfigTOML>());
    args = {"--tuple", "1", "2", "3", "4"};

    run();

    std::string str = app.config_to_str();
    CHECK(str == "tuple=[1, 2, 3, 4]\n");

as best as I can tell this should be working in the current release, so unless there is a specific further issue, I think this can be closed.

@pwm1234-sri
Copy link
Author

Let's close it then. I will re-open if I encounter problems.

@phlptp phlptp linked a pull request Oct 25, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants