What's the difference and which to use? #[clap(... x #[arg(... #5262
-
Both seem to work. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Beta Was this translation helpful? Give feedback.
-
Thank you very much for that! |
Beta Was this translation helpful? Give feedback.
-
I simply want to add that I also found this very confusing. I just spent a fair bit of time trying to make sense of the additional attributes since the fact that Of course, I may have simply missed something very obvious. So this is just my two cents as someone who is slightly frustrated that they had to dig around in the discussions to find information on this. Regardless, thank you for the amazing work on this crate. |
Beta Was this translation helpful? Give feedback.
-
This has been a source of so much frustration since half of examples on the internet use |
Beta Was this translation helpful? Give feedback.
#[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 behindcargo check -F clap/deprecated
.