-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add fmt::formatter
for Options
#2341
Conversation
This means that bool = options["foo"]; will still work, while dcomplex = options["foo"]; will need to be changed to: dcomplex = options["foo"].as<dcomplex>(); This is needed so that we can pass `Options` to templated functions and avoid ambiguous conversions, etc.
Previously `fmt::format("{}", options["value"])` was not handled correctly, as the formatting implicitly assumed the `Options` was a section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
clang-tidy review says "All clean, LGTM! 👍" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ZedThree It would be nice to have something in the manual on this, if you have time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ZedThree !
Options
can now be converted to a string withfmt::format
with the following format options:(happy to bikeshed these, but this vague set is useful)
This allows us to replace both
toString(Options)
andOptionINI::write
with calls tofmt::format
instead.The unused inputs error can now print out the type and docstring, e.g.:
which uses
fmt::format("\t{:idk}\n", suggestion)
for each suggested alternative.This will also be helpful for #2336, being able to print the docstring