mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
Merge pull request #3989 from cakebaker/clap_replace_deprecated_values_of_lossy
df: replace deprecated values_of_lossy()
This commit is contained in:
commit
6d5d6f2bb6
1 changed files with 7 additions and 2 deletions
|
@ -24,6 +24,7 @@ use uucore::{format_usage, show};
|
|||
use clap::{crate_version, Arg, ArgMatches, Command, ValueSource};
|
||||
|
||||
use std::error::Error;
|
||||
use std::ffi::OsString;
|
||||
use std::fmt;
|
||||
use std::path::Path;
|
||||
|
||||
|
@ -172,8 +173,12 @@ impl fmt::Display for OptionsError {
|
|||
impl Options {
|
||||
/// Convert command-line arguments into [`Options`].
|
||||
fn from(matches: &ArgMatches) -> Result<Self, OptionsError> {
|
||||
let include = matches.values_of_lossy(OPT_TYPE);
|
||||
let exclude = matches.values_of_lossy(OPT_EXCLUDE_TYPE);
|
||||
let include: Option<Vec<_>> = matches
|
||||
.get_many::<OsString>(OPT_TYPE)
|
||||
.map(|v| v.map(|s| s.to_string_lossy().to_string()).collect());
|
||||
let exclude: Option<Vec<_>> = matches
|
||||
.get_many::<OsString>(OPT_EXCLUDE_TYPE)
|
||||
.map(|v| v.map(|s| s.to_string_lossy().to_string()).collect());
|
||||
|
||||
if let (Some(include), Some(exclude)) = (&include, &exclude) {
|
||||
if let Some(types) = Self::get_intersected_types(include, exclude) {
|
||||
|
|
Loading…
Reference in a new issue