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:
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
@@ -2,6 +2,6 @@
|
||||
"uu_numfmt":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/default/trait.Default.html\" title=\"trait core::default::Default\">Default</a> for <a class=\"struct\" href=\"uu_numfmt/options/struct.FormatOptions.html\" title=\"struct uu_numfmt::options::FormatOptions\">FormatOptions</a>"]],
|
||||
"uu_sort":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/default/trait.Default.html\" title=\"trait core::default::Default\">Default</a> for <a class=\"struct\" href=\"uu_sort/struct.GlobalSettings.html\" title=\"struct uu_sort::GlobalSettings\">GlobalSettings</a>"]],
|
||||
"uu_stty":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/default/trait.Default.html\" title=\"trait core::default::Default\">Default</a> for <a class=\"struct\" href=\"uu_stty/struct.TermSize.html\" title=\"struct uu_stty::TermSize\">TermSize</a>"]],
|
||||
"uu_tail":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/default/trait.Default.html\" title=\"trait core::default::Default\">Default</a> for <a class=\"struct\" href=\"uu_tail/args/struct.Settings.html\" title=\"struct uu_tail::args::Settings\">Settings</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/default/trait.Default.html\" title=\"trait core::default::Default\">Default</a> for <a class=\"enum\" href=\"uu_tail/args/enum.FilterMode.html\" title=\"enum uu_tail::args::FilterMode\">FilterMode</a>"]],
|
||||
"uu_tail":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/default/trait.Default.html\" title=\"trait core::default::Default\">Default</a> for <a class=\"enum\" href=\"uu_tail/args/enum.FilterMode.html\" title=\"enum uu_tail::args::FilterMode\">FilterMode</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/default/trait.Default.html\" title=\"trait core::default::Default\">Default</a> for <a class=\"struct\" href=\"uu_tail/args/struct.Settings.html\" title=\"struct uu_tail::args::Settings\">Settings</a>"]],
|
||||
"uucore":[["impl<'parser> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/default/trait.Default.html\" title=\"trait core::default::Default\">Default</a> for <a class=\"struct\" href=\"uucore/parse_size/struct.Parser.html\" title=\"struct uucore::parse_size::Parser\">Parser</a><'parser>"]]
|
||||
};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
|
||||
File diff suppressed because one or more lines are too long
@@ -4,6 +4,6 @@
|
||||
"uu_numfmt":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uu_numfmt/options/enum.RoundMethod.html\" title=\"enum uu_numfmt::options::RoundMethod\">RoundMethod</a>"]],
|
||||
"uu_sort":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uu_sort/enum.GeneralF64ParseResult.html\" title=\"enum uu_sort::GeneralF64ParseResult\">GeneralF64ParseResult</a>"]],
|
||||
"uu_stty":[["impl<T: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"struct\" href=\"uu_stty/struct.Flag.html\" title=\"struct uu_stty::Flag\">Flag</a><T>"]],
|
||||
"uu_tail":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uu_tail/args/enum.FollowMode.html\" title=\"enum uu_tail::args::FollowMode\">FollowMode</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uu_tail/args/enum.Signum.html\" title=\"enum uu_tail::args::Signum\">Signum</a>"]],
|
||||
"uu_tail":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uu_tail/args/enum.Signum.html\" title=\"enum uu_tail::args::Signum\">Signum</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uu_tail/args/enum.FollowMode.html\" title=\"enum uu_tail::args::FollowMode\">FollowMode</a>"]],
|
||||
"uucore":[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uucore/quoting_style/enum.Quotes.html\" title=\"enum uucore::quoting_style::Quotes\">Quotes</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uucore/fs/enum.ResolveMode.html\" title=\"enum uucore::fs::ResolveMode\">ResolveMode</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uucore/encoding/enum.Format.html\" title=\"enum uucore::encoding::Format\">Format</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uucore/backup_control/enum.BackupMode.html\" title=\"enum uucore::backup_control::BackupMode\">BackupMode</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.70.0/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"uucore/fs/enum.MissingHandling.html\" title=\"enum uucore::fs::MissingHandling\">MissingHandling</a>"]]
|
||||
};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -219,6 +219,22 @@
|
||||
<a href="#219" id="219">219</a>
|
||||
<a href="#220" id="220">220</a>
|
||||
<a href="#221" id="221">221</a>
|
||||
<a href="#222" id="222">222</a>
|
||||
<a href="#223" id="223">223</a>
|
||||
<a href="#224" id="224">224</a>
|
||||
<a href="#225" id="225">225</a>
|
||||
<a href="#226" id="226">226</a>
|
||||
<a href="#227" id="227">227</a>
|
||||
<a href="#228" id="228">228</a>
|
||||
<a href="#229" id="229">229</a>
|
||||
<a href="#230" id="230">230</a>
|
||||
<a href="#231" id="231">231</a>
|
||||
<a href="#232" id="232">232</a>
|
||||
<a href="#233" id="233">233</a>
|
||||
<a href="#234" id="234">234</a>
|
||||
<a href="#235" id="235">235</a>
|
||||
<a href="#236" id="236">236</a>
|
||||
<a href="#237" id="237">237</a>
|
||||
</pre></div><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
|
||||
// *
|
||||
// * For the full copyright and license information, please view the LICENSE
|
||||
@@ -263,7 +279,7 @@
|
||||
/// This function returns the element of `mounts` on which `path` is
|
||||
/// mounted. If there are no matches, this function returns
|
||||
/// [`None`]. If there are two or more matches, then the single
|
||||
/// [`MountInfo`] with the longest mount directory is returned.
|
||||
/// [`MountInfo`] with the device name corresponding to the entered path.
|
||||
///
|
||||
/// If `canonicalize` is `true`, then the `path` is canonicalized
|
||||
/// before checking whether it matches any mount directories.
|
||||
@@ -289,9 +305,19 @@
|
||||
path.as_ref().to_path_buf()
|
||||
};
|
||||
|
||||
<span class="kw">let </span>maybe_mount_point = mounts
|
||||
<span class="comment">// Find the potential mount point that matches entered path
|
||||
</span><span class="kw">let </span>maybe_mount_point = mounts
|
||||
.iter()
|
||||
.find(|mi| mi.dev_name.eq(<span class="kw-2">&</span>path.to_string_lossy()));
|
||||
<span class="comment">// Create pair MountInfo, canonicalized device name
|
||||
// TODO Abstract from accessing real filesystem to
|
||||
// make code more testable
|
||||
</span>.map(|m| (m, std::fs::canonicalize(<span class="kw-2">&</span>m.dev_name)))
|
||||
<span class="comment">// Ignore non existing paths
|
||||
</span>.filter(|m| m.<span class="number">1</span>.is_ok())
|
||||
.map(|m| (m.<span class="number">0</span>, m.<span class="number">1</span>.ok().unwrap()))
|
||||
<span class="comment">// Try to find canonicalized device name corresponding to entered path
|
||||
</span>.find(|m| m.<span class="number">1</span>.eq(<span class="kw-2">&</span>path))
|
||||
.map(|m| m.<span class="number">0</span>);
|
||||
|
||||
maybe_mount_point.or_else(|| {
|
||||
mounts
|
||||
@@ -432,10 +458,16 @@
|
||||
|
||||
<span class="attr">#[test]
|
||||
</span><span class="kw">fn </span>test_dev_name_match() {
|
||||
<span class="kw">let </span>tmp = tempfile::TempDir::new().expect(<span class="string">"Failed to create temp dir"</span>);
|
||||
<span class="kw">let </span>dev_name = std::fs::canonicalize(tmp.path())
|
||||
.expect(<span class="string">"Failed to canonicalize tmp path"</span>)
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>mount_info = mount_info(<span class="string">"/foo"</span>);
|
||||
mount_info.dev_name = <span class="string">"/dev/sda2"</span>.to_string();
|
||||
mount_info.dev_name = dev_name.clone();
|
||||
<span class="kw">let </span>mounts = [mount_info];
|
||||
<span class="kw">let </span>actual = mount_info_from_path(<span class="kw-2">&</span>mounts, <span class="string">"/dev/sda2"</span>, <span class="bool-val">false</span>).unwrap();
|
||||
<span class="kw">let </span>actual = mount_info_from_path(<span class="kw-2">&</span>mounts, dev_name, <span class="bool-val">false</span>).unwrap();
|
||||
<span class="macro">assert!</span>(mount_info_eq(actual, <span class="kw-2">&</span>mounts[<span class="number">0</span>]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,8 @@
|
||||
<a href="#99" id="99">99</a>
|
||||
<a href="#100" id="100">100</a>
|
||||
<a href="#101" id="101">101</a>
|
||||
<a href="#102" id="102">102</a>
|
||||
<a href="#103" id="103">103</a>
|
||||
</pre></div><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
|
||||
// *
|
||||
// * (c) Alex Lyon <arcterus@mail.com>
|
||||
@@ -115,7 +117,7 @@
|
||||
};
|
||||
|
||||
<span class="kw">use </span>clap::{crate_version, Arg, ArgAction, Command};
|
||||
<span class="kw">use </span>fundu::{<span class="self">self</span>, DurationParser, ParseError};
|
||||
<span class="kw">use </span>fundu::{<span class="self">self</span>, DurationParser, ParseError, SaturatingInto};
|
||||
|
||||
<span class="kw">static </span>ABOUT: <span class="kw-2">&</span>str = <span class="macro">help_about!</span>(<span class="string">"sleep.md"</span>);
|
||||
<span class="kw">const </span>USAGE: <span class="kw-2">&</span>str = <span class="macro">help_usage!</span>(<span class="string">"sleep.md"</span>);
|
||||
@@ -164,7 +166,7 @@
|
||||
<span class="kw">fn </span>sleep(args: <span class="kw-2">&</span>[<span class="kw-2">&</span>str]) -> UResult<()> {
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>arg_error = <span class="bool-val">false</span>;
|
||||
|
||||
<span class="kw">use </span>fundu::TimeUnit::<span class="kw-2">*</span>;
|
||||
<span class="kw">use </span>fundu::TimeUnit::{Day, Hour, Minute, Second};
|
||||
<span class="kw">let </span>parser = DurationParser::with_time_units(<span class="kw-2">&</span>[Second, Minute, Hour, Day]);
|
||||
|
||||
<span class="kw">let </span>sleep_dur = args
|
||||
@@ -192,7 +194,9 @@
|
||||
<span class="prelude-val">None
|
||||
</span>}
|
||||
})
|
||||
.fold(Duration::ZERO, |acc, n| acc.saturating_add(n));
|
||||
.fold(Duration::ZERO, |acc, n| {
|
||||
acc.saturating_add(SaturatingInto::<std::time::Duration>::saturating_into(n))
|
||||
});
|
||||
|
||||
<span class="kw">if </span>arg_error {
|
||||
<span class="kw">return </span><span class="prelude-val">Err</span>(UUsageError::new(<span class="number">1</span>, <span class="string">""</span>));
|
||||
|
||||
@@ -680,6 +680,9 @@
|
||||
<a href="#680" id="680">680</a>
|
||||
<a href="#681" id="681">681</a>
|
||||
<a href="#682" id="682">682</a>
|
||||
<a href="#683" id="683">683</a>
|
||||
<a href="#684" id="684">684</a>
|
||||
<a href="#685" id="685">685</a>
|
||||
</pre></div><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
|
||||
// *
|
||||
// * For the full copyright and license information, please view the LICENSE
|
||||
@@ -691,7 +694,7 @@
|
||||
<span class="kw">use crate</span>::{parse, platform, Quotable};
|
||||
<span class="kw">use </span>clap::crate_version;
|
||||
<span class="kw">use </span>clap::{Arg, ArgAction, ArgMatches, Command};
|
||||
<span class="kw">use </span>fundu::DurationParser;
|
||||
<span class="kw">use </span>fundu::{DurationParser, SaturatingInto};
|
||||
<span class="kw">use </span>is_terminal::IsTerminal;
|
||||
<span class="kw">use </span>same_file::Handle;
|
||||
<span class="kw">use </span>std::collections::VecDeque;
|
||||
@@ -917,12 +920,15 @@
|
||||
// `DURATION::MAX` or `infinity` was given
|
||||
// * not applied here but it supports customizable time units and provides better error
|
||||
// messages
|
||||
</span>settings.sleep_sec =
|
||||
DurationParser::without_time_units()
|
||||
.parse(source)
|
||||
.map_err(|<span class="kw">_</span>| {
|
||||
UUsageError::new(<span class="number">1</span>, <span class="macro">format!</span>(<span class="string">"invalid number of seconds: '{source}'"</span>))
|
||||
})<span class="question-mark">?</span>;
|
||||
</span>settings.sleep_sec = <span class="kw">match </span>DurationParser::without_time_units().parse(source) {
|
||||
<span class="prelude-val">Ok</span>(duration) => SaturatingInto::<std::time::Duration>::saturating_into(duration),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => {
|
||||
<span class="kw">return </span><span class="prelude-val">Err</span>(UUsageError::new(
|
||||
<span class="number">1</span>,
|
||||
<span class="macro">format!</span>(<span class="string">"invalid number of seconds: '{source}'"</span>),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">if let </span><span class="prelude-val">Some</span>(s) = matches.get_one::<String>(options::MAX_UNCHANGED_STATS) {
|
||||
|
||||
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
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user