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

docs: value_name in magic attributes #5518

Closed
wants to merge 1 commit into from
Closed

Conversation

fowles
Copy link

@fowles fowles commented Jun 5, 2024

No description provided.

Comment on lines +145 to +146
//! - `value_name = <expr>`: [`Arg::value_name`][crate::Arg::value_name]
//! - When not present: [package `name`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value_name is not a command attribute

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#[derive(Parser, Debug)]
#[command(version)]
#[command(about = "Diff files using patience algorithm")]
struct Args {
  /// Path to old file or `-` for stdin.
  #[clap(name = "OLD_FILE")]
  lhs: PathBuf,

  /// Path to new file or `-` for stdin.
  #[clap(name = "NEW_FILE")]
  rhs: PathBuf,

  /// Display NUM lines of unchanged context before and after changes
  #[clap(short, long, value_name = "NUM", default_value_t = 3)]
  context: usize,
}

does what I want in terms of modifying the help text. Where should I document that?

Copy link
Author

@fowles fowles Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this qualifiers as a "raw attribute", but it really took me a while to find it, so I would like to do something to make it easier to find for new users.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That problem is being discussed in #4090

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a quick workaround for this point, I suggest adding a usage of value_name in the overview https://docs.rs/clap/latest/clap/_derive/index.html#overview

Would that patch be of interest?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each person will have their own pet attribute they would want highlighted on an example like that. The case would need to be made for why that attribute over any other. Most likely, that change won't happen.

@fowles fowles closed this Jun 5, 2024
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

2 participants