PackageTrack
Sign in Get early access

bpaf

A simple Command Line Argument Parser with parser combinators

0.9.27 7.4M downloads/mo #3688 most downloaded on crates.io pacak/bpaf

What this package is like to depend on

Last release 25 days ago

29 Jul 2026

Release timing varies

gaps range from 2 weeks to 8 months

Nearly every release is documented

notes for 64 of 68 stable releases

1 version withdrawn

withdrawn after publishing

4 years old

69 releases · first in 2022

7 releases in the last 12 months

see the full history below

Release timeline

69 releases · Mar 2022 to Jul 2026
2023 2024 2025 2026
Release Pre-release Withdrawn

Releases

latest 60 of 69
  1. 0.9.27 29 Jul 2026
    Release notes
    • improve error message if user passes an empty value to argument or positional
    Open source →
  2. 0.9.26 13 May 2026
    Release notes
    • Support struct level doc comments along with adjacent (#453)
    Open source →
  3. 0.9.25 15 Apr 2026
    Release notes
    • Change rendering of an adjacent block in Markdown - this is no longer a ### but a regular line item instead. Header messes up with generated navigation on some pages
    • app_name - parser that extracts the executable name
    Open source →
  4. 0.9.24 13 Mar 2026
    Release notes
    • a less confusing error message when invalid user input mixes with parsers that can succeed with no input, see #442 thanks @tonky for a solution prototype

    • CI test for older rustc now uses 1.71, MSRV should still be 1.60 for now

    Open source →
  5. 0.9.23 03 Feb 2026
    Release notes
    • don't trigger missing-docs lint
    Open source →
    Release notes
    • code produced by derive macro is now won't trigger missing-docs lint
    Open source →
  6. 0.9.22 16 Jan 2026
    Release notes
    • fix docs.rs generation
    Open source →
  7. 0.9.21 15 Jan 2026
    Release notes
    • Documentation fixes
    • minor derive macro improvements
    • MSRV is now 1.60
    Open source →
  8. 0.9.20 25 May 2025
    Release notes
    • Documentation fixes (#424) thanks @yuriks
    • A few clippy suggested fixes
    Open source →
  9. 0.9.19 13 Mar 2025
    Release notes
    • Fix one more problematic corner case of fallback_to_usage - it should no override inner parser printing usage or version info
    Open source →
  10. 0.9.18 06 Mar 2025
    Release notes
    • Several small documentation fixes (#414, #413) thanks @yerke
    • fallback_to_usage only applies if parser fails (#415) Previously it would print a usage info even if parser can succeed without any input
    Open source →
  11. 0.9.17 01 Mar 2025
    Release notes
    • A new method format_fallback allows to format fallback values using a custom formatting function. This extends functionality offered by format_debug and format_display that use Debug and Display instances respectively thanks @antalsz
    Open source →
  12. 0.9.16 24 Jan 2025
    Release notes
    • treat pure as an implicit consumer - don't add unnecessary .optional() or .many()
    • unbrainfart one of the examples
    Open source →
  13. 0.9.15 08 Oct 2024
    Release notes
    • a fix for a previous fix of fish completions, again - regenerate the files
    Open source →
  14. 0.9.14 19 Sep 2024
    Release notes
    • add license files (#388) thanks @davide
    • fix fish completions - you'll need to regenerate completion files for them to work
    Open source →
  15. 0.9.13 06 Sep 2024
    Release notes
    • You can now use fallback_to_usage in derive macro for options and subcommands (#376)
    • Bugfixes related to shell completion and file masks thanks @ozwaldorf
    • not_strict restriction for positional items (TODO - check the docs) thanks @ozwaldorf
    • more shell completion bugfixes (#384, #382, #381)
    • ParseFailure::print_mesage (with one s is deprecated in favor of the right spelling
    Open source →
  16. 0.9.12 29 Apr 2024
    Release notes
    • better error messages
    Open source →
  17. 0.9.11 24 Mar 2024
    Release notes
    • better error messages
    Open source →
  18. 0.9.10 19 Mar 2024
    Release notes
    • due to dependency change colored output for legacy version is no longer supported
    • Added OptionParser::max_width and #[bpaf(max_width(xxx))] to specify maximum width of help output
    • Added a custom path attribute to allow using of reexported bpaf thanks @bzm3r
    • support anywhere in bpaf_derive thanks @vallentin
    • small documentation improvements thanks @Boshen
    • minor shell completion improvements
    • avoid panic in case of hidden but required parser argument (#345)
    • somewhat breaking - ParseFailure::exit_code is separated into ParseFailure::exit_code and ParseFailure::print_message, one produces exit code, one prints the message
    Open source →
  19. 0.9.9 17 Jan 2024
    Release notes
    • fix formatting in ambiguity error message
    • relax upper range on owo-colors
    Open source →
  20. 0.9.8 06 Dec 2023
    Release notes
    • fix docs.rs build
    • bump deps
    Open source →
  21. 0.9.7 06 Dec 2023
    Release notes
    • updated documentation
    • support for #[bpaf(ignore_rustdoc)]
    Open source →
  22. 0.9.6 30 Oct 2023
    Release notes
    • make sure env-only arguments and flags are working
    • support raw identifiers in derive macro (#282)
    • better error messages for unexpected values that prevent positional parses
    • bugfix in completions generator for bash thanks @akinomyoga
    • choice combinator to efficiently construct alternative parsers at runtime
    Open source →
  23. 0.9.5 24 Aug 2023
    Release notes
    • fancier squashing: parse -abfoo as -a -b=foo if b is a short argument
    • bpaf_derive: make sure command aliases are actually working
    Open source →
  24. 0.9.4 08 Aug 2023
    Release notes
    • add help to ParseFlag and ParseArgument
    • stop deprecating Parser::run
    • Lots of docs.rs documentation improvements
    • changes to rendered markdown
    Open source →
  25. 0.9.3 26 Jul 2023
    Release notes
    • Parser::collect allows to collect multiple items into an arbitrary FromIterator collection
    • Bugfix in parsing for unit structs
    • docs.rs documentation update
    Open source →
  26. 0.9.2 13 Jul 2023
    Release notes
    • with docgen feature you can render documentation as markdown
    • cosmetic changes to error messages
    Open source →
  27. 0.9.1 05 Jul 2023
    Release notes
    • add a way to print usage when called with no argument_os
    • since 0.9.0 bpaf splits help messages into "full" and "partial", displaying full only when --help flag is passed twice or when rendering the documentation, see https://docs.rs/bpaf/0.9.0/bpaf/parsers/struct.NamedArg.html#method.help
    • display_fallback and debug_fallback now can be used with fallback_with
    • regression fixes
    Open source →
  28. 0.9.0 03 Jul 2023
    Release notes
    • more errors are now passed as ADTs rather than plain strings
    • conflicts are now tracked with indices rather than parser meta
    • documentation improvements
    • better error messages
    • smaller generated binary

    Breaking changes

    • bpaf_derive 0.5.0 comes with some breaking changes
    • documentation generation now comes under docgen feature instead of manpage and some things are renamed
    • standalone command function was deprecated in favor of .command method on OptionParser
    • hidden no-op helper type FromUtf8 was removed
    • "{usage}" override is removed in favor of new OptionParser::with_usage
    Open source →
  29. 0.8.1 30 May 2023
    Release notes
    • combination of command and hide now works as expected in bpaf_derive
    Open source →
  30. 0.8.0 11 May 2023
    Release notes

    Breaking changes

    • any now takes a function that checks if it matches the input or not. You can still apply usual filtering with guard, etc after it but initial filtering inside a function leads to better error messages.
    • anywhere is now a method on any instead of being a parser method and should now be used to make an arbitrary looking flag like parsers. You can still parse blocks from arbitrary places using remaining adjacent method
    • many and some will now collect one result from a parser that does not consume anything from an argument list allowing for easier composition with parsers that consume from both command line and environment variables. If your code depends on the original behavior you should replace non failing parsers under many with failing parsers: req_flag instead of switch.

    Improvements

    • parsing combinators many, some, optional and anywhere will now propagate parsing errors outwards, you can regain the old behvior by specifying catch
    • better error messages related to anywhere parsers
    • anywhere parsers are now given an attempt to consume an empty list
    • support deriving req_flag consumers
    • support deriving catch annotation
    • errors generated by some can now be handled with fallback/fallback_with
    • fallback values can be made visible in --help with display_fallback/debug_fallback
    • bpaf_derive: top level doc comments on a regular parser are now turned into a group_help
    • better error messages for invalid user input
    • env fallback can now be fully hidden
    • meta description refactor - invididual parsers should be described more consistently in all sorts of messages
    • better error messages with positionals and inside anywhere blocks

    Migration guide 0.7.x -> 0.8.x

    1. if you used any to consume items without validations just pass Some as a parameter and add two wildcard generic type parameters:
      -let rest = any<OsString>("RESt").many();
      +let rest = any<OsString, _, _>("REST", Some);
      
    2. If you used any with extra validation to decide if something should be consumed at all you can move this validation inside of any. If validation fails - any behaves as if this argument wasn't specified at all:
      -let name = any("NAME").guard(|x| x == "Bob", "Only Bob is allowed").optional().catch();
      +let name = any("NAME", |x| (x == "Bob").then_some(x));
      
    3. You can replicate most of the behavior from old anywhere modifier with new adjacent:
      -let set = construct!(set, name, value).anywhere();
      +let set = construct!(set, name, value).adjacent();
      
    4. If you previously used switch or an option with fallback in combination with many you need to replace switch with something that needs at least one item and move fallback outside:
      -let verbose = short('v').switch().many().map(|x| x.len());
      +let verbose = short('v').req_flag(()).many().map(|x| x.len());
      
    Open source →
  31. 0.7.10 19 Mar 2023
    Release notes
    • improve error messages for typos like -llvm instead of --llvm
    • improve error messages when a flag is accepted by a command but not directly
    • allow to derive position bool
    • derive anywhere and boxed
    • dynamic layout for --help messages
    • bump syn to 2.0
    Open source →
  32. 0.7.9 14 Feb 2023
    Release notes
    • ParseFailure::exit_code
    • A way to specify custom usage in derive macro
    Open source →
  33. 0.7.8 02 Feb 2023
    Release notes
    • manpage generation bugfixes, thanks to @ysndr
    • internal cleanups
    • avoid impossible shell completions
    Open source →
  34. 0.7.7 04 Dec 2022
    Release notes
    • manpage generation
    Open source →
  35. 0.7.6 29 Nov 2022
    Release notes
    • fix docs.rs issues
    Open source →
  36. 0.7.5 29 Nov 2022
    Release notes
    • improve error messages when several conflicting options are specified
    • improve category theory docs
    • improve docs for batteries
    Open source →
  37. 0.7.4 20 Nov 2022
    Release notes
    • bpaf_derive: improve error message
    • bpaf: bugfix for bash static shell completion
    Open source →
  38. 0.7.3 14 Nov 2022
    Release notes
    • try_run thanks to @ysndr
    • -Obits=2048 is now parsed as short flag O with a value of bits=2048 instad of crashing
    • complete_shell - a way to call to static shell completion functions, bash and zsh only for now
    Open source →
  39. 0.7.2 27 Oct 2022
    Release notes
    • drop tainting logic, should be redundant
    • improve error messages for guard and conflicting branches
    Open source →
  40. 0.7.1 15 Oct 2022
    Release notes
    • colors similar to cargo'some thanks to @kramer425
    • support for empty structs/enums in construct!
    Open source →
  41. 0.7.0 11 Oct 2022
    Release notes
    • pure_with implementation thanks to @xitep
    • FromOsStr is replaced with magical uses of Any trait
    • hide_usage
    • bright-color and dull-color features
    • accept fully qualified names in more places in bpaf_derive
    • cosmetic improvements
    • documentation improvements

    Migration guide 0.6.x -> 0.7.x

    1. Remove FromUtf8 annotations if you have any
      -let coin = short('c').argument::<FromUtf8<Coin>>("COIN");
      +let coin = short('c').argument::<Coin>("COIN");
      
      In many cases rustc should be able to derive what the type
    2. Replace FromOsStr implementations for your types with FromStr if you have any. If your type requires parsing OsString directly you can perform it in two steps - consuming OsString + parsing it with Parser::parse
    3. If you want to provide your users with colored output - expose bright-color and/or dull-color features
    Open source →
  42. 0.6.1 30 Sep 2022
    Release notes
    • cosmetic improvements
    • completion info in sensors example
    • better errors in partially consumed optional items
    • better handling of -- during autcomplete
    • initial release of bpaf_cauwugo
    Open source →
  43. 0.6.0 23 Sep 2022
    Release notes

    What's new in 0.6.0

    • adjacent restriction to parse things in a tighter context
    • catch for many, some and optional to handle parse errors
    • any positional like, to consume pretty much anything from a command line
    • improved documentation with more detailed examples
    • cosmetic improvements
    • a sneaky reminder to use to_options on Parser before trying to run it
    • removed OsString specific positional_os and argument_os
    • a way to make boxed parsers with single item construct! macro for making dynamic parsers
    • a horrible way to reduce Yoda-talk coding by placing primitive definitions inside the construct! macro

    With new additions you should be able to parse pretty much anything and then some more :)

    Migration guide 0.5.x -> 0.6.x

    1. Replace any uses of positional_os and argument_os with positional and argument plus turbofish:
      -let file = positional_os("FILE").help("File to use").map(PathBuf::from);
      +let file = positional::<PathBuf>("FILE").help("File to use");
      
    2. Replace any uses of from_str with either turbofish on the consumer or with parse, if String is generated inside the parser:
      -let number = short('n').argument("N").from_str::<usize>();
      +let number = short('n').argument::<usize>("N");
      
      You can still use it for your own types if you implement FromOsStr, alternatively parse still works:
      -let my = long("my-type").argument("MAGIC").from_str::<MyType>();
      +let my = long("my-type").argument::<String>("MAGIC").parse(|s| MyType::from_str(s));
      
    3. You shouldn't be using those names directly in your code, but there are some renames
      • Positional -> ParsePositional
      • BuildArgument -> ParseArgument
      • Command -> ParseCommand
      • Named -> NamedArg
    Open source →
  44. 0.5.7 04 Sep 2022
    Release notes
    • bugfix with zsh autocomplete #46
    • reimplement bpaf derive - should be faster to compile and easier to work with
    Open source →
  45. 0.5.6 03 Sep 2022
    Release notes
    • minor doc fixes
    • bugfix for dynamic completion
    Open source →
  46. 0.5.5 02 Sep 2022
    Release notes
    • invariant checker - for tests
    • more error message improvements
    • non-utf8 support in --foo=bar / -f=bar
    • dynamic shell completion: bash, zsh, fish, elvish
    • toggle flag battery
    • templated usage string: can use "{usage}" in custom overrides
    Open source →
  47. 0.5.4 25 Aug 2022
    Release notes

    minor bugfixes

    • more consistent alternative selection
    • handle "missing" inside a subparser
    Open source →
  48. 0.5.3 23 Aug 2022
    Release notes

    and a bit more cosmetics - preserve suggestion context when returning from a subcommand

    Open source →
  49. 0.5.2 23 Aug 2022
    Release notes
    • fix a regression in error messaged caused by 0.5.1
    • guard now displays the problematic input if it's a single argument issue
    Open source →
  50. 0.5.1 22 Aug 2022 withdrawn
    Release notes

    improve error messages if argument parsing fails:

    • matcher no longer escapes inner command if it gets there
    • detect and try to suggest for possible typos
    Open source →
  51. 0.5.0 21 Aug 2022
    Release notes

    should be faster to compile and a bit more flexible with respect to what is accepted

    Braking changes

    • explicit construct annotation is gone and used by default if options and command are missing
    • options and command now must be specified at the beginning of #[bpaf(... macro
    • default annotation for enum variants is gone, you can use fallback on top instead
    Open source →
  52. 0.4.12 08 Aug 2022
    Release notes
    • bpaf now depends on a specific version of bpaf_derive
    Open source →
  53. 0.4.11 07 Aug 2022
    Release notes
    • meta and item refactors, changed the formatting a bit
    Open source →
  54. 0.4.10 06 Aug 2022
    Release notes
    • bugfix for custom usage formatting
    Open source →
  55. 0.4.9 03 Aug 2022
    Release notes
    • bugfix for help rendering with fallback
    Open source →
  56. 0.4.8 02 Aug 2022
    Release notes
    • support for env
    Open source →
  57. 0.4.7 28 Jun 2022
    Release notes
    • support arbitrary long paths in construct! macro
    Open source →
  58. 0.4.6 28 Jun 2022

    Nothing published for this version

  59. 0.4.5 25 Jun 2022
    Release notes
    • use $crate:: inside construct to allow using it without importing
    Open source →
  60. 0.4.4 05 Jun 2022
    Release notes
    • lower minimum supported rustc version to 1.56
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive