Skip to content

Commit

Permalink
Improve Arg::value_hint documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr committed Jul 21, 2020
1 parent 07d6601 commit 44c4fde
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/build/arg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4091,11 +4091,12 @@ impl<'help> Arg<'help> {
self
}

/// Sets a hint about the type of the value for shell completions
/// Sets a hint about the type of the value for shell completions. See [`ValueHint`]
/// documentation for details.
///
/// Currently this is only supported by the zsh completions generator.
/// **NOTE:** Implicitly sets [`ArgSettings::TakesValue`]
///
/// For example, to take a username as argument:
/// # Examples
/// ```
/// # use clap::{Arg, ValueHint};
/// Arg::new("user")
Expand All @@ -4117,6 +4118,8 @@ impl<'help> Arg<'help> {
/// )
/// # ;
/// ```
/// [`ValueHint`]: ./enum.ValueHint.html
/// [`ArgSettings::TakesValue`]: ./enum.ArgSettings.html#variant.TakesValue
pub fn value_hint(mut self, value_hint: ValueHint) -> Self {
self.set_mut(ArgSettings::TakesValue);
self.value_hint = value_hint;
Expand Down

0 comments on commit 44c4fde

Please sign in to comment.