-
Notifications
You must be signed in to change notification settings - Fork 17
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
Top level parser group_help
breaks help message
#319
Comments
group_help
breaks help message
This is somewhat expected behavior. What kind of use case for |
Let me try to elaborate, I think this is somewhat related to #290 as well What I'm trying to do is to separate the rust doc comments from cli help. thus, in the top-level parser i include groups and set group help either through rustdoc comment (or group_help if i dont particularly care about the rustdoc). However, this way there seems now no way to add a general description to the application as in adding headers and footers to the command. use bpaf::{Bpaf, Parser};
// /// commented command << this line breaks things
#[derive(Bpaf)]
// #[bpaf(group_help("breaks stuff too"))]
struct MyArgs {
/// commended flag
flag: bool,
/// primary group description (ignored)
/// rustdoc comment
#[bpaf(external(my_group))]
primary_group: MyGroup,
/// rustdoc comment
#[bpaf(external(my_group2), group_help("secondary group description"))]
secondary: MyGroup2,
}
/// Group of primary subcommands
#[derive(Bpaf, Clone)]
#[bpaf(group_help("primary group description"))] // ignored?
enum MyGroup {
/// run command
#[bpaf(command)]
Run,
}
/// Group of primary subcommands
#[derive(Bpaf, Clone)]
enum MyGroup2 {
/// build command
#[bpaf(command)]
// #[bpaf(help("description for command"))] // unavailable?
Build,
}
fn main() {
my_args().to_options().run();
} |
I see. I think I understand what you mean, will try to make something to
address this issues.
…On Mon, Nov 27, 2023, 10:52 Yannik Sander ***@***.***> wrote:
Let me try to elaborate, I think this is somewhat related to #290
<#290> as well
What I'm trying to do is to separate the rust doc comments from cli help.
IMO the doc comments are not helpful within rustdoc but i can't add rust
doc comments.
thus, in the top-level parser i include groups and set group help either
through rustdoc comment (or group_help if i dont particularly care about
the rustdoc).
I'd like to do so on the group enum itself but group_help in that position
seems to be ignored (#290 <#290>)
However, this way there seems now no way to add a general description to
the application as in adding headers and footers to the command.
When I add a doc comment or grouphelp to MyArgs here, the groups defined
therein are getting messed up.
``rust
use bpaf::{Bpaf, Parser};
// /// commented command << this line breaks things
#[derive(Bpaf)]
// #[bpaf(group_help("breaks stuff too"))]
struct MyArgs {
/// commended flag
flag: bool,
/// primary group description (ignored)
/// rustdoc comment
#[bpaf(external(my_group))]
primary_group: MyGroup,
/// rustdoc comment
#[bpaf(external(my_group2), group_help("secondary group description"))]
secondary: MyGroup2,
}
/// Group of primary subcommands
#[derive(Bpaf, Clone)]
#[bpaf(group_help("primary group description"))] // ignored?
enum MyGroup {
/// run command
#[bpaf(command)]
Run,
}
/// Group of primary subcommands
#[derive(Bpaf, Clone)]
enum MyGroup2 {
/// build command
#[bpaf(command)]
// #[bpaf(help("description for command"))] // unavailable?
Build,
}
fn main() {
my_args().to_options().run();
}
—
Reply to this email directly, view it on GitHub
<#319 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAQFI4TSIV5BHS73T5QAVLYGSZNRAVCNFSM6AAAAAA7V4Z7YKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRYGEYDSNJWGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Note it behaves differently if using |
I added |
resolved in #321 |
When adding
documentationgroup_help to the top level parser via a doc comment or the
group_help` annotation, the generated help message becomes malformatted.It appears as if the doc comments for fields of the parser are interpreted as general documentation:
without the parser comment:
with the parser comment:
with
group_help
The text was updated successfully, but these errors were encountered: