NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #3706 most downloaded on crates.io
A simple Command Line Argument Parser with parser combinators
Last release 21 days ago
17 Sep 2026
Release timing varies
gaps range from 2 weeks to 8 months
Nearly every release is documented
notes for 59 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
5 years old
70 releases · first in 2022
One column per quarter.
more consistent formatting for .adjacent() items
improve error message if user passes an empty value to argument or positional
Support struct level doc comments along with adjacent
adjacent (#453)Change rendering of an adjacent block in Markdown - this is no longer a ### but a regular line item instead. Header messes up with generated navigatio
###
but a regular line item instead. Header messes up with generated navigation on
some pagesapp_name - parser that extracts the executable namea less confusing error message when invalid user input mixes with parsers that can succeed with no input, see #442 thanks @tonky for a solution protot
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
don't trigger missing-docs lint
- fix docs.rs generation
minor derive macro improvements
Documentation fixes (#424) thanks @yuriks
Fix one more problematic corner case of fallback_to_usage - it should no override inner parser printing usage or version info
fallback_to_usage - it should no override
inner parser printing usage or version infoSeveral 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 inputA new method format_fallback allows to format fallback values using a custom formatting function. This extends functionality offered by format_debug a
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 @antalsztreat pure as an implicit consumer - don't add unnecessary .optional() or .many()
pure as an implicit consumer - don't add unnecessary .optional() or .many()a fix for a previous fix of fish completions, again - regenerate the files
add license files (#388) thanks @davide
ParseFailure::print_mesage (with one s is deprecated in favor of the right spelling
fallback_to_usage in derive macro for options and subcommands (#376)not_strict restriction for positional items (TODO - check the docs)
thanks @ozwaldorfParseFailure::print_mesage (with one s is deprecated in favor of the right spelling- better error messages
- better error messages
due to dependency change colored output for legacy version is no longer supported
OptionParser::max_width and #[bpaf(max_width(xxx))] to specify maximum
width of help outputParseFailure::exit_code is separated into
ParseFailure::exit_code and ParseFailure::print_message, one produces
exit code, one prints the messagefix formatting in ambiguity error message
- fix docs.rs build - bump deps
support for #[bpaf(ignore_rustdoc)]
#[bpaf(ignore_rustdoc)]make sure env-only arguments and flags are working
choice combinator to efficiently construct alternative parsers at runtimefancier squashing: parse -abfoo as -a -b=foo if b is a short argument
-abfoo as -a -b=foo if b is a short argumentbpaf_derive: make sure command aliases are actually workingadd help to ParseFlag and ParseArgument
help to ParseFlag and ParseArgumentParser::runParser::collect allows to collect multiple items into an arbitrary FromIterator collection
Parser::collect allows to collect multiple items into an arbitrary FromIterator collectionwith docgen feature you can render documentation as markdown
docgen feature you can render documentation as markdownadd a way to print usage when called with no argument_os
--help flag is passed twice or when rendering the documentation,
see https://docs.rs/bpaf/0.9.0/bpaf/parsers/struct.NamedArg.html#method.helpdisplay_fallback and debug_fallback now can be used with fallback_withbpaf_derive 0.5.0 comes with some breaking changes
bpaf_derive 0.5.0 comes with some breaking changesdocgen feature instead of manpage and some
things are renamedcommand function was deprecated in favor of .command method on OptionParserFromUtf8 was removedOptionParser::with_usagecombination of command and hide now works as expected in bpaf_derive
command and hide now works as expected in bpaf_deriveany 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 filterin
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
methodmany 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.many, some, optional and anywhere will
now propagate parsing errors outwards, you can regain the old
behvior by specifying catchanywhere parsersanywhere parsers are now given an attempt to consume an empty listreq_flag consumerscatch annotationsome can now be handled with fallback/fallback_with--help with display_fallback/debug_fallbackbpaf_derive: top level doc comments on a regular parser are now turned into a group_helpany 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);
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));
anywhere modifier with new adjacent:-let set = construct!(set, name, value).anywhere();
+let set = construct!(set, name, value).adjacent();
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());
improve error messages for typos like -llvm instead of --llvm
-llvm instead of --llvmA way to specify custom usage in derive macro
ParseFailure::exit_codemanpage generation bugfixes, thanks to @ysndr
- manpage generation
- fix docs.rs issues
improve error messages when several conflicting options are specified
bpaf_derive: improve error message
-Obits=2048 is now parsed as short flag O with a value of bits=2048 instad of crashing
try_run
thanks to @ysndr-Obits=2048 is now parsed as short flag O with a value of bits=2048 instad of crashingcomplete_shell - a way to call to static shell completion functions, bash and zsh only for
nowdrop tainting logic, should be redundant
colors similar to cargo'some thanks to @kramer425
construct!pure_with implementation thanks to @xitep
pure_with implementation
thanks to @xitepFromOsStr is replaced with magical uses of Any traithide_usagebright-color and dull-color featuresbpaf_derive-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 typeFromOsStr 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::parsebright-color and/or dull-color featurescompletion info in sensors example
sensors examplebpaf_cauwugoadjacent restriction to parse things in a tighter context
adjacent restriction to parse things in a tighter contextcatch for many, some and optional to handle parse errorsany positional like, to consume pretty much anything from a command lineto_options on Parser before trying to run itpositional_os and argument_osconstruct! macro for making dynamic parsersconstruct! macroWith new additions you should be able to parse pretty much anything and then some more :)
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");
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));
Positional -> ParsePositionalBuildArgument -> ParseArgumentCommand -> ParseCommandNamed -> NamedArgbugfix with zsh autocomplete #46
- minor doc fixes - bugfix for dynamic completion
more error message improvements
more consistent alternative selection
minor bugfixes
and a bit more cosmetics - preserve suggestion context when returning from a subcommand
and a bit more cosmetics - preserve suggestion context when returning from a subcommand
fix a regression in error messaged caused by 0.5.1
improve error messages if argument parsing fails:
improve error messages if argument parsing fails:
should be faster to compile and a bit more flexible with respect to what is accepted
should be faster to compile and a bit more flexible with respect to what is accepted
construct annotation is gone and used by default if options and command are
missingoptions and command now must be specified at the beginning of #[bpaf(... macrodefault annotation for enum variants is gone, you can use fallback on top insteadbpaf now depends on a specific version of bpaf_derive
meta and item refactors, changed the formatting a bit
bugfix for custom usage formatting
bugfix for help rendering with fallback
- support for env
support arbitrary long paths in construct! macro
Nothing published for this version
use $crate:: inside construct to allow using it without importing
Your coding agent can read these notes before it upgrades. Set up the MCP server →