Skip to content
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 recommendations for option parsing #35

Open
springmeyer opened this issue Sep 10, 2017 · 7 comments
Open

Add recommendations for option parsing #35

springmeyer opened this issue Sep 10, 2017 · 7 comments

Comments

@springmeyer
Copy link
Contributor

In C++ my experience says:

  • 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.

/cc @GretaCB @joto @mapbox/core-tech @danpat

@springmeyer
Copy link
Contributor Author

@joto
Copy link

joto commented 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 to boost::program_options anyway.

@joto
Copy link

joto commented 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
Copy link
Contributor Author

Just learned from @kkaefer that mbgl is using https://github.com/Taywee/args for demo apps - which @brunoabinader brought in.

@springmeyer
Copy link
Contributor Author

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
Copy link

joto commented Feb 22, 2018

My experience with Clara so far:

Positive:

  • Easy to use, clean code.
  • Easy to integrate 42k header file.
  • In active development.

Negative:

  • Documentation is not complete.
  • Still in development, changes to be expected.
  • 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.)

@springmeyer
Copy link
Contributor Author

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.)

👍 looking forward to learning more as you use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants