Skip to content

What's the difference and which to use? #[clap(... x #[arg(... #5262

Answered by epage
alanwilter asked this question in Q&A
Discussion options

You must be logged in to vote

#[clap()] is what was exclusively used in clap v3. In clap v4, we introduced more specific attributes which has allowed things like #[group] and #[command] attributes existing at the top-level and it better relates the attributes to the builder API to help people connect the two together. #[clap] attributes are deprecated and will be removed in clap v5. We don't proactively show deprecation messages due to feedback from users who don't want to see them until they are ready to process them, so we put them behind cargo check -F clap/deprecated.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by alanwilter
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants