Open AbitTheGray opened 4 months ago
I think your suggested syntax does look better. I'm happy to look at a PR with the changes. I don't really want to use std::format because I want to keep supporting older versions of c++.
Our team would prefer syntax like the following:
--foo [=BAR]
Handling of empty strings is also sub-par, showing up like this right now:
--foo [=FOO-ARG(=)]
(default: )
We would prefer the empty implicit value to be replaced with <empty>
or something similar.
Sorry for late reply due to lack of time.
I hastily put together the small formatting tweak (--output [BIN=b.def]
) in MR to my fork.
If you wish, there is another MR with ability to specify format for each option (not a good idea, more of PoC). It can be behind CMake option()
so you need to explicitly enable it (for those who don't have C++20 support or just don't want the functionality).
I would like to tweak it to be configured on cxxopts::Options
instead of Value
/HelpOptionDetails
but I will need to find time to look into it.
Hi, I was configuring cxxopts for new project and used some implicit values. They look a little too complex for me
with a little tweak (see below) you can have one of those
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 likebut I would like it to look like one of those
to be more in line with the one without implicit value
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.