-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Derive API doesn't respect id
attribute
#3785
Comments
I wrote a quick fix for this, but I have a couple of questions before I submit a PR:
|
While this is murkier in clap v3, clap v4 is working to make this more obvious (some deprecations move us in this direction): Us conflating the two has led to maintainer confusion in some of the design and user confusion in how they are used.
Could you clarify what you mean? Are you speaking in terms of should this apply to both Arg and Command? Yes, we should respect explicit overrides in both
Commits should be atomic. If the code is deviating from the documentation, the documentation should be updated at the same time. What documentation updates do you see being needed? |
Thanks for the quick response. I‘m not very familiar with clap’s internals, so I appreciate your clarifications. It sounds like the attribute behavior should be different for Command and Arg. Specifically:
There are a few derive reference doc updates needed:
|
From a users perspective,
From a users perspective, Something that confuses the matter further is |
Seems like we should disallow the Here is the solution I have that effectively just recognizes the |
I'd say that solution is good enough for now. Note that we would merge for master first which would has all deprecated functionality removed. We'd want to add back in the If we want to go for the error, short term, we could augment Longer term, I'm going to be splitting up the attributes like |
Thanks for all of your clarifications and help. I’ve submitted PR #4049; let me know if it needs updates. |
Please complete the following tasks
Rust Version
rustc 1.60.0 (7737e0b5c 2022-04-04)
Clap Version
3.1.18
Minimal reproducible code
playground
Steps to reproduce the bug with the above code
cargo run
Actual Behaviour
Panics with a message:
Expected Behaviour
In the code above, you can replace
id
withname
and it will work just fine.Arg::id
was introduced in 3.1.0, it's supposed to replaceArg::name
. However, derive api doesn't work withid
attribute, it keeps supportingname
attribute that refers to deprecated method.I expect that
id
attribute will have the same behaviour asname
. Moreover, to be aligned with changes in library API, derive API ideally should yield a warning thatname
attribute is deprecated.Additional Context
No response
Debug Output
No response
The text was updated successfully, but these errors were encountered: