Skip to content

Commit

Permalink
fix(parser): Deprecate value_of and friends
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed May 25, 2022
1 parent 256643f commit c5ac8f3
Show file tree
Hide file tree
Showing 36 changed files with 1,365 additions and 799 deletions.
4 changes: 2 additions & 2 deletions clap_complete/examples/completion.rs
Expand Up @@ -99,9 +99,9 @@ fn print_completions<G: Generator>(gen: G, cmd: &mut Command) {
fn main() {
let matches = build_cli().get_matches();

if let Ok(generator) = matches.value_of_t::<Shell>("generator") {
if let Some(generator) = matches.get_one::<Shell>("generator") {
let mut cmd = build_cli();
eprintln!("Generating completion file for {}...", generator);
print_completions(generator, &mut cmd);
print_completions(*generator, &mut cmd);
}
}
6 changes: 3 additions & 3 deletions src/derive.rs
Expand Up @@ -70,7 +70,7 @@ use std::ffi::OsString;
/// fn from(m: ArgMatches) -> Self {
/// Context {
/// verbose: m.is_present("verbose"),
/// name: m.value_of("name").map(|n| n.to_owned()),
/// name: m.get_one::<String>("name").map(|n| n.clone()),
/// }
/// }
/// }
Expand Down Expand Up @@ -286,7 +286,7 @@ pub trait FromArgMatches: Sized {
/// impl From<ArgMatches> for Context {
/// fn from(m: ArgMatches) -> Self {
/// Context {
/// name: m.value_of("name").unwrap().to_string(),
/// name: m.get_one::<String>("name").unwrap().clone(),
/// debug: m.is_present("debug"),
/// }
/// }
Expand Down Expand Up @@ -320,7 +320,7 @@ pub trait FromArgMatches: Sized {
/// impl From<ArgMatches> for Context {
/// fn from(m: ArgMatches) -> Self {
/// Context {
/// name: m.value_of("name").unwrap().to_string(),
/// name: m.get_one::<String>("name").unwrap().to_string(),
/// debug: m.is_present("debug"),
/// }
/// }
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -42,6 +42,7 @@ pub use crate::derive::{ArgEnum, Args, CommandFactory, FromArgMatches, Parser, S
pub use crate::builder::App;
pub use crate::builder::{AppFlags, AppSettings, ArgFlags, ArgSettings, PossibleValue, ValueHint};
pub use crate::error::{ErrorKind, Result};
#[allow(deprecated)]
pub use crate::parser::{Indices, OsValues, ValueSource, Values};

#[cfg(feature = "yaml")]
Expand Down

0 comments on commit c5ac8f3

Please sign in to comment.