Yet another command line argument parser: bpaf 0.6.0

123 points manpacket

Hi, I want to share my command line argument parser library: https://crates.io/crates/bpaf

Bpaf is a lightweight command line parser with a API that supports both combinatoric and derive approaches and gives strictly typed results back. Fast compilation time, no external dependencies unless you opt-in into derive feature.

  • Help generation, usage line generation
  • Very small API - all you need to know is about 10 API names, total API size is about 25-30 or so names
  • arbitrarily nested commands, including chaining and repeating them
  • full non-utf8 argument support
  • dynamic shell completion
  • Follows "parse, don't validate" approach for parsing
  • No unsafe code
  • Happy users and developers :)

From the last announcement after some great feedback from /u/epage I removed some OsString specific functions (this is now available via a trait) and added a few constraining functions - as a result you can now parse pretty much anything you want.

Since traditional question about CLI parsers is "why use that vs clap":

  • as far as parsing goes supported feature set should be about the same, but you can also compose available primitives to parse more unusual things: https://docs.rs/bpaf/0.6.0/bpaf/_unusual/index.html
  • 5-7 times smaller API size, easy to find what you want, easy to master
  • 5-7 times faster compilation - great for CI and development
  • 5-7 times smaller overhead in binary files - great for shipping
  • dynamic shell completion - great for being user friendly

There's a nice overview made by /u/epage
https://github.com/rosetta-rs/argparse-rosetta-rs/blob/main/docs/tradeoffs.md

But in short rather than giving you a bunch of pre-made ways to deal with something bpaf gives you a bunch of primitives you can chain them a la iterators.

Migration guide from 0.5.x is here: https://github.com/pacak/bpaf/blob/master/Changelog.md

And if you have any questions - I'm happy to answer.

edit: formatting