-
Notifications
You must be signed in to change notification settings - Fork 632
Description
Hi, I was configuring cxxopts for new project and used some implicit values. They look a little too complex for me
--fullscreen [=monitor_name(=PRIMARY)]
with a little tweak (see below) you can have one of those
--fullscreen [monitor_name]=PRIMARY
--fullscreen [monitor_name=PRIMARY]
but I know it may not fit everyone.
Would you consider using std::format (since C++20) to allow more customization? Either per-option or at higher level.
Here is the little tweak on cxxopts.hpp around LN2150.
At the end of format_option is for options with implicit value formatting like
result += " [=" + arg + "(=" + toLocalString(o.implicit_value) + ")]";
but I would like it to look like one of those
result += " " + arg + "=" + toLocalString(o.implicit_value);
result += " [" + arg + "=" + toLocalString(o.implicit_value) + "]";
to be more in line with the one without implicit value
result += " " + arg;
My personal goal is to have <argument> for options with required values and [argument=DEFAULT] or [argument]=DEFAULT.
I like this library, if you like I will prepare the change as Pull Request. I just need to know whenever you like the idea and how to approach it.