Skip to content
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

fix(derive): Replace clap attributes with command, arg, and value #4180

Merged
merged 5 commits into from
Sep 2, 2022

Conversation

epage
Copy link
Member

@epage epage commented Sep 2, 2022

Example:

/// Simple program to greet a person
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
    /// Name of the person to greet
    #[arg(short, long)]
    name: String,

    /// Number of times to greet
    #[arg(short, long, default_value_t = 1)]
    count: u8,
}

For the short term, this removes some of the magic so people have a better idea of how the derive connects to the builder API which is a continual problem (#4090) and makes it easier to document attributes generally.

Longer term, this is a step towards allowing command attributes on args/fields which will help with next_help_heading, etc. See #1807

Verified

This commit was signed with the committer’s verified signature.
rbuckton Ron Buckton

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@epage epage merged commit f513862 into clap-rs:master Sep 2, 2022
@epage epage deleted the specialized branch September 2, 2022 21:01
runsisi added a commit to runsisi/corrosion that referenced this pull request Sep 2, 2024
even though `#[clap()]` still works, `#[command()]` and `#[arg()]` are now
recommended since clap v4, ref clap-rs/clap#4180

Signed-off-by: runsisi <runsisi@hust.edu.cn>
jeromegn pushed a commit to superfly/corrosion that referenced this pull request Sep 2, 2024
even though `#[clap()]` still works, `#[command()]` and `#[arg()]` are now
recommended since clap v4, ref clap-rs/clap#4180

Signed-off-by: runsisi <runsisi@hust.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant