jarro2783 / cxxopts

Lightweight C++ command line option parser
MIT License
4.16k stars 582 forks source link

What is the use of constructor parameters in options("MyProgram", "One line description of MyProgram")? #415

Closed pauljurczak closed 7 months ago

pauljurczak commented 8 months ago

What is the use of these two strings?

cxxopts::Options options("MyProgram", "One line description of MyProgram");
jarro2783 commented 8 months ago

They are both used in the help string produced by --help.

pauljurczak commented 8 months ago

It seems that help option has to be defined for this to work. Otherwise, I'm getting:

terminate called after throwing an instance of 'cxxopts::exceptions::no_such_option'
  what():  Option 'help' does not exist
jarro2783 commented 8 months ago

Yes there is no default way to print the help, so that you can make it behave as you want for your program. You can add a help option to print it if you want.

On Thu, 28 Dec 2023, 05:32 Paul Jurczak, @.***> wrote:

It seems that help option has to be defined for this to work. Otherwise, I'm getting:

terminate called after throwing an instance of 'cxxopts::exceptions::no_such_option' what(): Option 'help' does not exist

— Reply to this email directly, view it on GitHub https://github.com/jarro2783/cxxopts/issues/415#issuecomment-1870537198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALDQ4UXCBYDDUXTPWBCUZLYLRSUJAVCNFSM6AAAAABBCF6MUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQGUZTOMJZHA . You are receiving this because you commented.Message ID: @.***>