You've already forked uutils.github.io
mirror of
https://github.com/uutils/uutils.github.io.git
synced 2026-06-10 16:12:28 -07:00
deploy: f0e8d44e6e
This commit is contained in:
@@ -317,10 +317,10 @@
|
||||
<span class="kw">use </span>uucore::error::{set_exit_code, UClapError, UResult, UUsageError};
|
||||
<span class="kw">use </span>uucore::fs::{canonicalize, MissingHandling, ResolveMode};
|
||||
<span class="kw">use </span>uucore::libc::{<span class="self">self</span>, chroot, setgid, setgroups, setuid};
|
||||
<span class="kw">use </span>uucore::{entries, format_usage};
|
||||
<span class="kw">use </span>uucore::{entries, format_usage, help_about, help_usage};
|
||||
|
||||
<span class="kw">static </span>ABOUT: <span class="kw-2">&</span>str = <span class="string">"Run COMMAND with root directory set to NEWROOT."</span>;
|
||||
<span class="kw">static </span>USAGE: <span class="kw-2">&</span>str = <span class="string">"{} [OPTION]... NEWROOT [COMMAND [ARG]...]"</span>;
|
||||
<span class="kw">static </span>ABOUT: <span class="kw-2">&</span>str = <span class="macro">help_about!</span>(<span class="string">"chroot.md"</span>);
|
||||
<span class="kw">static </span>USAGE: <span class="kw-2">&</span>str = <span class="macro">help_usage!</span>(<span class="string">"chroot.md"</span>);
|
||||
|
||||
<span class="kw">mod </span>options {
|
||||
<span class="kw">pub const </span>NEWROOT: <span class="kw-2">&</span>str = <span class="string">"newroot"</span>;
|
||||
|
||||
+16
-16
@@ -1889,7 +1889,7 @@
|
||||
<span class="kw">use </span>std::path::{Path, PathBuf, StripPrefixError};
|
||||
<span class="kw">use </span>std::string::ToString;
|
||||
|
||||
<span class="kw">use </span>clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
|
||||
<span class="kw">use </span>clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command};
|
||||
<span class="kw">use </span>filetime::FileTime;
|
||||
<span class="kw">use </span>indicatif::{ProgressBar, ProgressStyle};
|
||||
<span class="attr">#[cfg(unix)]
|
||||
@@ -1954,7 +1954,7 @@
|
||||
<span class="doccomment">/// Invalid arguments to backup
|
||||
</span>Backup(description: String) { display(<span class="string">"{}\nTry '{} --help' for more information."</span>, description, uucore::execution_phrase()) }
|
||||
|
||||
NotADirectory(path: String) { display(<span class="string">"'{}' is not a directory"</span>, path) }
|
||||
NotADirectory(path: PathBuf) { display(<span class="string">"'{}' is not a directory"</span>, path.display()) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2085,7 +2085,7 @@
|
||||
attributes: Attributes,
|
||||
recursive: bool,
|
||||
backup_suffix: String,
|
||||
target_dir: <span class="prelude-ty">Option</span><String>,
|
||||
target_dir: <span class="prelude-ty">Option</span><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(<span class="string">"copy all SOURCE arguments into target-directory"</span>),
|
||||
)
|
||||
.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 => <span class="macro">print!</span>(<span class="string">"{}"</span>, app.render_version()),
|
||||
<span class="kw">_ </span>=> <span class="kw">return </span><span class="prelude-val">Err</span>(Box::new(e.with_exit_code(<span class="number">1</span>))),
|
||||
};
|
||||
} <span class="kw">else if let </span><span class="prelude-val">Ok</span>(matches) = matches {
|
||||
} <span class="kw">else if let </span><span class="prelude-val">Ok</span>(<span class="kw-2">mut </span>matches) = matches {
|
||||
<span class="kw">let </span>options = Options::from_matches(<span class="kw-2">&</span>matches)<span class="question-mark">?</span>;
|
||||
|
||||
<span class="kw">if </span>options.overwrite == OverwriteMode::NoClobber && options.backup != BackupMode::NoBackup {
|
||||
@@ -2449,12 +2451,12 @@
|
||||
));
|
||||
}
|
||||
|
||||
<span class="kw">let </span>paths: Vec<String> = matches
|
||||
.get_many::<String>(options::PATHS)
|
||||
.map(|v| v.map(ToString::to_string).collect())
|
||||
<span class="kw">let </span>paths: Vec<PathBuf> = matches
|
||||
.remove_many::<PathBuf>(options::PATHS)
|
||||
.map(|v| v.collect())
|
||||
.unwrap_or_default();
|
||||
|
||||
<span class="kw">let </span>(sources, target) = parse_path_args(<span class="kw-2">&</span>paths, <span class="kw-2">&</span>options)<span class="question-mark">?</span>;
|
||||
<span class="kw">let </span>(sources, target) = parse_path_args(paths, <span class="kw-2">&</span>options)<span class="question-mark">?</span>;
|
||||
|
||||
<span class="kw">if let </span><span class="prelude-val">Err</span>(error) = copy(<span class="kw-2">&</span>sources, <span class="kw-2">&</span>target, <span class="kw-2">&</span>options) {
|
||||
<span class="kw">match </span>error {
|
||||
@@ -2617,11 +2619,11 @@
|
||||
<span class="comment">// Parse target directory options
|
||||
</span><span class="kw">let </span>no_target_dir = matches.get_flag(options::NO_TARGET_DIRECTORY);
|
||||
<span class="kw">let </span>target_dir = matches
|
||||
.get_one::<String>(options::TARGET_DIRECTORY)
|
||||
.map(ToString::to_string);
|
||||
.get_one::<PathBuf>(options::TARGET_DIRECTORY)
|
||||
.cloned();
|
||||
|
||||
<span class="kw">if let </span><span class="prelude-val">Some</span>(dir) = <span class="kw-2">&</span>target_dir {
|
||||
<span class="kw">if </span>!Path::new(dir).is_dir() {
|
||||
<span class="kw">if </span>!dir.is_dir() {
|
||||
<span class="kw">return </span><span class="prelude-val">Err</span>(Error::NotADirectory(dir.clone()));
|
||||
}
|
||||
};
|
||||
@@ -2778,9 +2780,7 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Returns tuple of (Source paths, Target)
|
||||
</span><span class="kw">fn </span>parse_path_args(path_args: <span class="kw-2">&</span>[String], options: <span class="kw-2">&</span>Options) -> CopyResult<(Vec<Source>, Target)> {
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>paths = path_args.iter().map(PathBuf::from).collect::<Vec<<span class="kw">_</span>>>();
|
||||
|
||||
</span><span class="kw">fn </span>parse_path_args(<span class="kw-2">mut </span>paths: Vec<Source>, options: <span class="kw-2">&</span>Options) -> CopyResult<(Vec<Source>, Target)> {
|
||||
<span class="kw">if </span>paths.is_empty() {
|
||||
<span class="comment">// No files specified
|
||||
</span><span class="kw">return </span><span class="prelude-val">Err</span>(<span class="string">"missing file operand"</span>.into());
|
||||
@@ -2796,7 +2796,7 @@
|
||||
<span class="prelude-val">Some</span>(<span class="kw-2">ref </span>target) => {
|
||||
<span class="comment">// All path args are sources, and the target dir was
|
||||
// specified separately
|
||||
</span>PathBuf::from(target)
|
||||
</span>target.clone()
|
||||
}
|
||||
<span class="prelude-val">None </span>=> {
|
||||
<span class="comment">// If there was no explicit target-dir, then use the last
|
||||
|
||||
@@ -866,12 +866,6 @@
|
||||
<a href="#866" id="866">866</a>
|
||||
<a href="#867" id="867">867</a>
|
||||
<a href="#868" id="868">868</a>
|
||||
<a href="#869" id="869">869</a>
|
||||
<a href="#870" id="870">870</a>
|
||||
<a href="#871" id="871">871</a>
|
||||
<a href="#872" id="872">872</a>
|
||||
<a href="#873" id="873">873</a>
|
||||
<a href="#874" id="874">874</a>
|
||||
</pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
|
||||
// *
|
||||
// * (c) Dorota Kapturkiewicz <dokaptur@gmail.com>
|
||||
@@ -893,16 +887,10 @@
|
||||
<span class="kw">use </span>std::num::ParseIntError;
|
||||
<span class="kw">use </span>uucore::display::Quotable;
|
||||
<span class="kw">use </span>uucore::error::{FromIo, UError, UResult};
|
||||
<span class="kw">use </span>uucore::format_usage;
|
||||
<span class="kw">use </span>uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
<span class="kw">const </span>USAGE: <span class="kw-2">&</span>str = <span class="string">"\
|
||||
{} [OPTION]... [INPUT]...
|
||||
{} -G [OPTION]... [INPUT [OUTPUT]]"</span>;
|
||||
|
||||
<span class="kw">const </span>ABOUT: <span class="kw-2">&</span>str = <span class="string">"\
|
||||
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 /'."</span>;
|
||||
<span class="kw">const </span>USAGE: <span class="kw-2">&</span>str = <span class="macro">help_usage!</span>(<span class="string">"ptx.md"</span>);
|
||||
<span class="kw">const </span>ABOUT: <span class="kw-2">&</span>str = <span class="macro">help_about!</span>(<span class="string">"ptx.md"</span>);
|
||||
|
||||
<span class="kw">const </span>REGEX_CHARCLASS: <span class="kw-2">&</span>str = <span class="string">"^-]\\"</span>;
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user