diff --git a/Cargo.toml b/Cargo.toml index 5150dc97..678e6903 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bpaf" -version = "0.9.25" +version = "0.9.26" edition = "2021" categories = ["command-line-interface"] description = "A simple Command Line Argument Parser with parser combinators" @@ -21,7 +21,7 @@ include = [ [dependencies] -bpaf_derive = { path = "./bpaf_derive", version = "=0.5.23", optional = true } +bpaf_derive = { path = "./bpaf_derive", version = "=0.5.26", optional = true } owo-colors = { version = ">=3.5, <5.0", default-features = false, optional = true } supports-color = { version = ">=2.0.0, <4.0", optional = true } diff --git a/Changelog.md b/Changelog.md index 142753db..c847f0b7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Change Log +## bpaf [0.9.26], bpaf_derive [0.5.26] - 2026-05-13 +- Support struct level doc comments along with `adjacent` (#453) + ## bpaf [0.9.25] - 2026-04-15 - 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 diff --git a/bpaf_derive/Cargo.toml b/bpaf_derive/Cargo.toml index 9419d6c2..ec65938e 100644 --- a/bpaf_derive/Cargo.toml +++ b/bpaf_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bpaf_derive" -version = "0.5.23" +version = "0.5.26" edition = "2018" categories = ["command-line-interface"] description = "Derive macros for bpaf Command Line Argument Parser" diff --git a/bpaf_derive/src/top.rs b/bpaf_derive/src/top.rs index d858eb0a..1eb99ac3 100644 --- a/bpaf_derive/src/top.rs +++ b/bpaf_derive/src/top.rs @@ -306,8 +306,8 @@ impl ToTokens for Top { #[allow(unused_imports)] use ::bpaf::Parser; #body - #group_help #adjacent + #group_help #(.#attrs)* #boxed } diff --git a/bpaf_derive/src/top_tests.rs b/bpaf_derive/src/top_tests.rs index 1271e3e4..b4a1fa97 100644 --- a/bpaf_derive/src/top_tests.rs +++ b/bpaf_derive/src/top_tests.rs @@ -1112,6 +1112,35 @@ fn adjacent_for_struct() { assert_eq!(top.to_token_stream().to_string(), expected.to_string()); } +#[test] +fn adjacent_with_group_help() { + let top: Top = parse_quote! { + #[bpaf(adjacent)] + /// help text + struct Opts { + a: String, + b: String, + } + }; + + let expected = quote! { + #[doc(hidden)] + fn opts() -> impl ::bpaf::Parser { + #[allow(unused_imports)] + use ::bpaf::Parser; + { + let a = ::bpaf::short('a').argument::("ARG"); + let b = ::bpaf::short('b').argument::("ARG"); + ::bpaf::construct!(Opts { a, b, }) + } + .adjacent() + .group_help("help text") + } + }; + + assert_eq!(top.to_token_stream().to_string(), expected.to_string()); +} + #[test] fn box_for_struct() { let top: Top = parse_quote! {