From 7fa795c2ae6db22d27429f1111a78fbb3b785afc Mon Sep 17 00:00:00 2001 From: sylvestre Date: Tue, 7 Mar 2023 03:03:43 +0000 Subject: [PATCH] deploy: f0e8d44e6e64ee3354f95864c0a25b74cf1c1151 --- dev/src/uu_chroot/chroot.rs.html | 6 +++--- dev/src/uu_cp/cp.rs.html | 32 ++++++++++++++++---------------- dev/src/uu_ptx/ptx.rs.html | 18 +++--------------- dev/uu_cp/enum.Error.html | 4 ++-- dev/uu_cp/fn.uu_app.html | 2 +- dev/uu_cp/fn.uumain.html | 2 +- dev/uu_ptx/fn.uu_app.html | 2 +- dev/uu_ptx/fn.uumain.html | 2 +- dev/uu_ptx/index.html | 2 +- 9 files changed, 29 insertions(+), 41 deletions(-) diff --git a/dev/src/uu_chroot/chroot.rs.html b/dev/src/uu_chroot/chroot.rs.html index b9e590afa..7f8b390a4 100644 --- a/dev/src/uu_chroot/chroot.rs.html +++ b/dev/src/uu_chroot/chroot.rs.html @@ -317,10 +317,10 @@ use uucore::error::{set_exit_code, UClapError, UResult, UUsageError}; use uucore::fs::{canonicalize, MissingHandling, ResolveMode}; use uucore::libc::{self, chroot, setgid, setgroups, setuid}; -use uucore::{entries, format_usage}; +use uucore::{entries, format_usage, help_about, help_usage}; -static ABOUT: &str = "Run COMMAND with root directory set to NEWROOT."; -static USAGE: &str = "{} [OPTION]... NEWROOT [COMMAND [ARG]...]"; +static ABOUT: &str = help_about!("chroot.md"); +static USAGE: &str = help_usage!("chroot.md"); mod options { pub const NEWROOT: &str = "newroot"; diff --git a/dev/src/uu_cp/cp.rs.html b/dev/src/uu_cp/cp.rs.html index 19c5bdf10..3b3640afb 100644 --- a/dev/src/uu_cp/cp.rs.html +++ b/dev/src/uu_cp/cp.rs.html @@ -1889,7 +1889,7 @@ use std::path::{Path, PathBuf, StripPrefixError}; use std::string::ToString; -use clap::{crate_version, Arg, ArgAction, ArgMatches, Command}; +use clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command}; use filetime::FileTime; use indicatif::{ProgressBar, ProgressStyle}; #[cfg(unix)] @@ -1954,7 +1954,7 @@ /// Invalid arguments to backup Backup(description: String) { display("{}\nTry '{} --help' for more information.", description, uucore::execution_phrase()) } - NotADirectory(path: String) { display("'{}' is not a directory", path) } + NotADirectory(path: PathBuf) { display("'{}' is not a directory", path.display()) } } } @@ -2085,7 +2085,7 @@ attributes: Attributes, recursive: bool, backup_suffix: String, - target_dir: Option<String>, + target_dir: Option<PathBuf>, update: bool, verbose: bool, progress_bar: bool, @@ -2165,6 +2165,7 @@ .long(options::TARGET_DIRECTORY) .value_name(options::TARGET_DIRECTORY) .value_hint(clap::ValueHint::DirPath) + .value_parser(ValueParser::path_buf()) .help("copy all SOURCE arguments into target-directory"), ) .arg( @@ -2418,7 +2419,8 @@ .arg( Arg::new(options::PATHS) .action(ArgAction::Append) - .value_hint(clap::ValueHint::AnyPath), + .value_hint(clap::ValueHint::AnyPath) + .value_parser(ValueParser::path_buf()), ) } @@ -2439,7 +2441,7 @@ clap::error::ErrorKind::DisplayVersion => print!("{}", app.render_version()), _ => return Err(Box::new(e.with_exit_code(1))), }; - } else if let Ok(matches) = matches { + } else if let Ok(mut matches) = matches { let options = Options::from_matches(&matches)?; if options.overwrite == OverwriteMode::NoClobber && options.backup != BackupMode::NoBackup { @@ -2449,12 +2451,12 @@ )); } - let paths: Vec<String> = matches - .get_many::<String>(options::PATHS) - .map(|v| v.map(ToString::to_string).collect()) + let paths: Vec<PathBuf> = matches + .remove_many::<PathBuf>(options::PATHS) + .map(|v| v.collect()) .unwrap_or_default(); - let (sources, target) = parse_path_args(&paths, &options)?; + let (sources, target) = parse_path_args(paths, &options)?; if let Err(error) = copy(&sources, &target, &options) { match error { @@ -2617,11 +2619,11 @@ // Parse target directory options let no_target_dir = matches.get_flag(options::NO_TARGET_DIRECTORY); let target_dir = matches - .get_one::<String>(options::TARGET_DIRECTORY) - .map(ToString::to_string); + .get_one::<PathBuf>(options::TARGET_DIRECTORY) + .cloned(); if let Some(dir) = &target_dir { - if !Path::new(dir).is_dir() { + if !dir.is_dir() { return Err(Error::NotADirectory(dir.clone())); } }; @@ -2778,9 +2780,7 @@ } /// Returns tuple of (Source paths, Target) -fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec<Source>, Target)> { - let mut paths = path_args.iter().map(PathBuf::from).collect::<Vec<_>>(); - +fn parse_path_args(mut paths: Vec<Source>, options: &Options) -> CopyResult<(Vec<Source>, Target)> { if paths.is_empty() { // No files specified return Err("missing file operand".into()); @@ -2796,7 +2796,7 @@ Some(ref target) => { // All path args are sources, and the target dir was // specified separately - PathBuf::from(target) + target.clone() } None => { // If there was no explicit target-dir, then use the last diff --git a/dev/src/uu_ptx/ptx.rs.html b/dev/src/uu_ptx/ptx.rs.html index 075103d8f..96b420e97 100644 --- a/dev/src/uu_ptx/ptx.rs.html +++ b/dev/src/uu_ptx/ptx.rs.html @@ -866,12 +866,6 @@ 866 867 868 -869 -870 -871 -872 -873 -874
//  * This file is part of the uutils coreutils package.
 //  *
 //  * (c) Dorota Kapturkiewicz <dokaptur@gmail.com>
@@ -893,16 +887,10 @@
 use std::num::ParseIntError;
 use uucore::display::Quotable;
 use uucore::error::{FromIo, UError, UResult};
-use uucore::format_usage;
+use uucore::{format_usage, help_about, help_usage};
 
-const USAGE: &str = "\
-    {} [OPTION]... [INPUT]...
-    {} -G [OPTION]... [INPUT [OUTPUT]]";
-
-const ABOUT: &str = "\
-    Output a permuted index, including context, of the words in the input files. \n\n\
-    Mandatory arguments to long options are mandatory for short options too.\n\
-    With no FILE, or when FILE is -, read standard input. Default is '-F /'.";
+const USAGE: &str = help_usage!("ptx.md");
+const ABOUT: &str = help_about!("ptx.md");
 
 const REGEX_CHARCLASS: &str = "^-]\\";
 
diff --git a/dev/uu_cp/enum.Error.html b/dev/uu_cp/enum.Error.html
index fc67ddb4c..f9d60eb39 100644
--- a/dev/uu_cp/enum.Error.html
+++ b/dev/uu_cp/enum.Error.html
@@ -9,7 +9,7 @@
     InvalidArgument(String),
     NotImplemented(String),
     Backup(String),
-    NotADirectory(String),
+    NotADirectory(PathBuf),
 }

Variants§

§

IoErr(Error)

Simple io::Error wrapper

§

IoErrContext(ErrorString)

Wrapper for io::Error with path context

§

Error(String)

General copy error

@@ -23,7 +23,7 @@ and not all files were copied.

path, but those that are not implemented yet should return a NotImplemented error.

§

Backup(String)

Invalid arguments to backup

-
§

NotADirectory(String)

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Error code of a custom error. Read more
Print usage help to a custom error. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+
§

NotADirectory(PathBuf)

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Error code of a custom error. Read more
Print usage help to a custom error. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

diff --git a/dev/uu_cp/fn.uu_app.html b/dev/uu_cp/fn.uu_app.html index 4351c498f..e9ec86815 100644 --- a/dev/uu_cp/fn.uu_app.html +++ b/dev/uu_cp/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_cp - Rust

Function uu_cp::uu_app

source ·
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_cp - Rust

Function uu_cp::uu_app

source ·
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_cp/fn.uumain.html b/dev/uu_cp/fn.uumain.html index cd7bdf8a7..dbb7e88d9 100644 --- a/dev/uu_cp/fn.uumain.html +++ b/dev/uu_cp/fn.uumain.html @@ -1 +1 @@ -uumain in uu_cp - Rust

Function uu_cp::uumain

source ·
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_cp - Rust

Function uu_cp::uumain

source ·
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_ptx/fn.uu_app.html b/dev/uu_ptx/fn.uu_app.html index 3ca4413c2..9ad1f759d 100644 --- a/dev/uu_ptx/fn.uu_app.html +++ b/dev/uu_ptx/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_ptx - Rust

Function uu_ptx::uu_app

source ·
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_ptx - Rust

Function uu_ptx::uu_app

source ·
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_ptx/fn.uumain.html b/dev/uu_ptx/fn.uumain.html index bfd7ee2c3..334147999 100644 --- a/dev/uu_ptx/fn.uumain.html +++ b/dev/uu_ptx/fn.uumain.html @@ -1 +1 @@ -uumain in uu_ptx - Rust

Function uu_ptx::uumain

source ·
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_ptx - Rust

Function uu_ptx::uumain

source ·
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_ptx/index.html b/dev/uu_ptx/index.html index bd530cc38..6bcbd0531 100644 --- a/dev/uu_ptx/index.html +++ b/dev/uu_ptx/index.html @@ -1 +1 @@ -uu_ptx - Rust
\ No newline at end of file +uu_ptx - Rust
\ No newline at end of file