You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If it is okay to use boost, use boost::program_options, it is a solid library.
It is often not okay to use boost. The headers alone are > 50 MB 馃檧 and contain > 13,000 files. And boost::program_options requires linking a precompiled library. This is massive weight and complexity for a build system just to parse options.
So for lightweight C++ libs that might not otherwise have any dependencies we need to recommend a very lightweight option parsing solution.
I usually just use getopt_long() available in libc for simpler cases. The interface is C and not C++ and slightly ugly. But for many cases this is simple enough and doesn't require an extra dependency. If this is not enough it is time to switch to boost::program_options anyway.
Something to investigate: Clara "A simple to use, composable, command line parser for C++ 11 and beyond". By the same guy who created the Catch unit test framework.
watching progress on Clara at mapbox/vtzero@70fc232. I'm in support for having Clara be our recommendation if @joto's experience is solid this week in this port.
Single - char as parameter (often used to denote stdin) is not possible.
I think it is too early to recommend this as a standard tool, but I think collecting some experience with it is probably a good idea. (That's why I went ahead and used it in the relatively simple vtzero examples.)
Activity
springmeyer commentedon Sep 10, 2017
libraries to investigate:
joto commentedon Sep 10, 2017
I usually just use
getopt_long()available in libc for simpler cases. The interface is C and not C++ and slightly ugly. But for many cases this is simple enough and doesn't require an extra dependency. If this is not enough it is time to switch toboost::program_optionsanyway.joto commentedon Nov 7, 2017
Something to investigate: Clara "A simple to use, composable, command line parser for C++ 11 and beyond". By the same guy who created the Catch unit test framework.
springmeyer commentedon Jan 4, 2018
Just learned from @kkaefer that mbgl is using https://github.com/Taywee/args for demo apps - which @brunoabinader brought in.
springmeyer commentedon Feb 21, 2018
watching progress on Clara at mapbox/vtzero@70fc232. I'm in support for having Clara be our recommendation if @joto's experience is solid this week in this port.
joto commentedon Feb 22, 2018
My experience with Clara so far:
Positive:
Negative:
-char as parameter (often used to denote stdin) is not possible.I think it is too early to recommend this as a standard tool, but I think collecting some experience with it is probably a good idea. (That's why I went ahead and used it in the relatively simple vtzero examples.)
springmeyer commentedon Feb 22, 2018
馃憤 looking forward to learning more as you use it.