Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr committed Jun 4, 2020
1 parent 8551f6f commit 553292a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
26 changes: 13 additions & 13 deletions clap_generate/examples/value_hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,70 +24,70 @@ fn build_cli() -> App<'static> {
.setting(AppSettings::DisableVersion)
.setting(AppSettings::TrailingVarArg)
.arg(
Arg::with_name("generator")
Arg::new("generator")
.long("generate")
.possible_values(&["bash", "fish", "zsh"]),
)
.arg(
Arg::with_name("unknown")
Arg::new("unknown")
.long("unknown")
.value_hint(ValueHint::Unknown),
)
.arg(
Arg::with_name("path")
Arg::new("path")
.long("path")
.short('p')
.value_hint(ValueHint::AnyPath),
)
.arg(
Arg::with_name("file")
Arg::new("file")
.long("file")
.short('f')
.value_hint(ValueHint::FilePath),
)
.arg(
Arg::with_name("dir")
Arg::new("dir")
.long("dir")
.short('d')
.value_hint(ValueHint::DirPath),
)
.arg(
Arg::with_name("exe")
Arg::new("exe")
.long("exe")
.short('e')
.value_hint(ValueHint::ExecutablePath),
)
.arg(
Arg::with_name("cmd_name")
Arg::new("cmd_name")
.long("cmd-name")
.value_hint(ValueHint::CommandName),
)
.arg(
Arg::with_name("cmd")
Arg::new("cmd")
.long("cmd")
.short('c')
.value_hint(ValueHint::CommandString),
)
.arg(
Arg::with_name("command_with_args")
Arg::new("command_with_args")
.multiple_values(true)
.value_hint(ValueHint::CommandWithArguments),
)
.arg(
Arg::with_name("user")
Arg::new("user")
.short('u')
.long("user")
.value_hint(ValueHint::Username),
)
.arg(
Arg::with_name("host")
Arg::new("host")
.short('h')
.long("host")
.value_hint(ValueHint::Hostname),
)
.arg(Arg::with_name("url").long("url").value_hint(ValueHint::Url))
.arg(Arg::new("url").long("url").value_hint(ValueHint::Url))
.arg(
Arg::with_name("email")
Arg::new("email")
.long("email")
.value_hint(ValueHint::EmailAddress),
)
Expand Down
2 changes: 1 addition & 1 deletion clap_generate/src/generators/shells/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ fn write_positionals_of(p: &App) -> String {
&& arg.is_set(ArgSettings::MultipleValues)
{
let a = "'*::arguments:_normal' \\".to_string();
debugln!("Zsh::write_positionals_of:iter: Wrote...{}", a);
debug!("Zsh::write_positionals_of:iter: Wrote...{}", a);
ret.push(a);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/build/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{
output::{fmt::Colorizer, Help, HelpWriter, Usage},
parse::{ArgMatcher, ArgMatches, Input, Parser},
util::{safe_exit, termcolor::ColorChoice, Id, Key},
Result as ClapResult, INTERNAL_ERROR_MSG,
Result as ClapResult, ValueHint, INTERNAL_ERROR_MSG,
};

// FIXME (@CreepySkeleton): some of these variants are never constructed
Expand Down
8 changes: 4 additions & 4 deletions src/build/arg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4143,27 +4143,27 @@ impl<'help> Arg<'help> {
/// For example, to take a username as argument:
/// ```
/// # use clap::{Arg, ValueHint};
/// Arg::with_name("user")
/// Arg::new("user")
/// .short('u')
/// .long("user")
/// .value_hint(ValueHint::Username)
/// # ;
/// ```
///
/// To take a full command line and its arguments (when writing a command wrapper):
/// To take a full command line and its arguments (for example, when writing a command wrapper):
/// ```
/// # use clap::{App, AppSettings, Arg, ValueHint};
/// App::new("prog")
/// .setting(AppSettings::TrailingVarArg)
/// .arg(
/// Arg::with_name("command")
/// Arg::new("command")
/// .multiple(true)
/// .value_hint(ValueHint::CommandWithArguments)
/// )
/// # ;
/// ```
pub fn value_hint(mut self, value_hint: ValueHint) -> Self {
self.setb(ArgSettings::TakesValue);
self.set_mut(ArgSettings::TakesValue);
self.value_hint = value_hint;
self
}
Expand Down

0 comments on commit 553292a

Please sign in to comment.