Skip to content

Commit 7483cee

Browse files
committed
deploy: f0e8d44
1 parent 8f6fdec commit 7483cee

38 files changed

+91
-89
lines changed

dev/src/uu_cat/cat.rs.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,6 @@
645645
<a href="#645" id="645">645</a>
646646
<a href="#646" id="646">646</a>
647647
<a href="#647" id="647">647</a>
648-
<a href="#648" id="648">648</a>
649648
</pre><pre class="rust"><code><span class="comment">// This file is part of the uutils coreutils package.
650649
//
651650
// (c) Jordi Boggiano &lt;j.boggiano@seld.be&gt;
@@ -681,11 +680,10 @@
681680
</span><span class="kw">use </span>std::os::unix::fs::FileTypeExt;
682681
<span class="attr">#[cfg(unix)]
683682
</span><span class="kw">use </span>std::os::unix::net::UnixStream;
684-
<span class="kw">use </span>uucore::format_usage;
683+
<span class="kw">use </span>uucore::{format_usage, help_section, help_usage};
685684

686-
<span class="kw">static </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;{} [OPTION]... [FILE]...&quot;</span>;
687-
<span class="kw">static </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="string">&quot;Concatenate FILE(s), or standard input, to standard output
688-
With no FILE, or when FILE is -, read standard input.&quot;</span>;
685+
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;cat.md&quot;</span>);
686+
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_section!</span>(<span class="string">&quot;about&quot;</span>, <span class="string">&quot;cat.md&quot;</span>);
689687

690688
<span class="attr">#[derive(Error, Debug)]
691689
</span><span class="kw">enum </span>CatError {

dev/src/uu_comm/comm.rs.html

+20-20
Original file line numberDiff line numberDiff line change
@@ -240,21 +240,12 @@
240240
<span class="kw">pub const </span>TOTAL: <span class="kw-2">&amp;</span>str = <span class="string">&quot;total&quot;</span>;
241241
}
242242

243-
<span class="kw">fn </span>mkdelim(col: usize, opts: <span class="kw-2">&amp;</span>ArgMatches) -&gt; String {
244-
<span class="kw">let </span><span class="kw-2">mut </span>s = String::new();
245-
<span class="kw">let </span>delim = <span class="kw">match </span>opts.get_one::&lt;String&gt;(options::DELIMITER).unwrap().as_str() {
246-
<span class="string">&quot;&quot; </span>=&gt; <span class="string">&quot;\0&quot;</span>,
247-
delim =&gt; delim,
248-
};
249-
250-
<span class="kw">if </span>col &gt; <span class="number">1 </span>&amp;&amp; !opts.get_flag(options::COLUMN_1) {
251-
s.push_str(delim.as_ref());
252-
}
253-
<span class="kw">if </span>col &gt; <span class="number">2 </span>&amp;&amp; !opts.get_flag(options::COLUMN_2) {
254-
s.push_str(delim.as_ref());
255-
}
256-
257-
s
243+
<span class="kw">fn </span>column_width(col: <span class="kw-2">&amp;</span>str, opts: <span class="kw-2">&amp;</span>ArgMatches) -&gt; usize {
244+
<span class="kw">if </span>opts.get_flag(col) {
245+
<span class="number">0
246+
</span>} <span class="kw">else </span>{
247+
<span class="number">1
248+
</span>}
258249
}
259250

260251
<span class="kw">fn </span>ensure_nl(line: <span class="kw-2">&amp;mut </span>String) {
@@ -278,7 +269,16 @@
278269
}
279270

280271
<span class="kw">fn </span>comm(a: <span class="kw-2">&amp;mut </span>LineReader, b: <span class="kw-2">&amp;mut </span>LineReader, opts: <span class="kw-2">&amp;</span>ArgMatches) {
281-
<span class="kw">let </span>delim: Vec&lt;String&gt; = (<span class="number">0</span>..<span class="number">4</span>).map(|col| mkdelim(col, opts)).collect();
272+
<span class="kw">let </span>delim = <span class="kw">match </span>opts.get_one::&lt;String&gt;(options::DELIMITER).unwrap().as_str() {
273+
<span class="string">&quot;&quot; </span>=&gt; <span class="string">&quot;\0&quot;</span>,
274+
delim =&gt; delim,
275+
};
276+
277+
<span class="kw">let </span>width_col_1 = column_width(options::COLUMN_1, opts);
278+
<span class="kw">let </span>width_col_2 = column_width(options::COLUMN_2, opts);
279+
280+
<span class="kw">let </span>delim_col_2 = delim.repeat(width_col_1);
281+
<span class="kw">let </span>delim_col_3 = delim.repeat(width_col_1 + width_col_2);
282282

283283
<span class="kw">let </span>ra = <span class="kw-2">&amp;mut </span>String::new();
284284
<span class="kw">let </span><span class="kw-2">mut </span>na = a.read_line(ra);
@@ -306,7 +306,7 @@
306306
Ordering::Less =&gt; {
307307
<span class="kw">if </span>!opts.get_flag(options::COLUMN_1) {
308308
ensure_nl(ra);
309-
<span class="macro">print!</span>(<span class="string">&quot;{}{}&quot;</span>, delim[<span class="number">1</span>], ra);
309+
<span class="macro">print!</span>(<span class="string">&quot;{ra}&quot;</span>);
310310
}
311311
ra.clear();
312312
na = a.read_line(ra);
@@ -315,7 +315,7 @@
315315
Ordering::Greater =&gt; {
316316
<span class="kw">if </span>!opts.get_flag(options::COLUMN_2) {
317317
ensure_nl(rb);
318-
<span class="macro">print!</span>(<span class="string">&quot;{}{}&quot;</span>, delim[<span class="number">2</span>], rb);
318+
<span class="macro">print!</span>(<span class="string">&quot;{delim_col_2}{rb}&quot;</span>);
319319
}
320320
rb.clear();
321321
nb = b.read_line(rb);
@@ -324,7 +324,7 @@
324324
Ordering::Equal =&gt; {
325325
<span class="kw">if </span>!opts.get_flag(options::COLUMN_3) {
326326
ensure_nl(ra);
327-
<span class="macro">print!</span>(<span class="string">&quot;{}{}&quot;</span>, delim[<span class="number">3</span>], ra);
327+
<span class="macro">print!</span>(<span class="string">&quot;{delim_col_3}{ra}&quot;</span>);
328328
}
329329
ra.clear();
330330
rb.clear();
@@ -336,7 +336,7 @@
336336
}
337337

338338
<span class="kw">if </span>opts.get_flag(options::TOTAL) {
339-
<span class="macro">println!</span>(<span class="string">&quot;{total_col_1}\t{total_col_2}\t{total_col_3}\ttotal&quot;</span>);
339+
<span class="macro">println!</span>(<span class="string">&quot;{total_col_1}{delim}{total_col_2}{delim}{total_col_3}{delim}total&quot;</span>);
340340
}
341341
}
342342

dev/src/uu_cp/cp.rs.html

+3-9
Original file line numberDiff line numberDiff line change
@@ -1861,9 +1861,6 @@
18611861
<a href="#1861" id="1861">1861</a>
18621862
<a href="#1862" id="1862">1862</a>
18631863
<a href="#1863" id="1863">1863</a>
1864-
<a href="#1864" id="1864">1864</a>
1865-
<a href="#1865" id="1865">1865</a>
1866-
<a href="#1866" id="1866">1866</a>
18671864
</pre><pre class="rust"><code><span class="attr">#![allow(clippy::missing_safety_doc)]
18681865
#![allow(clippy::extra_unused_lifetimes)]
18691866

@@ -1906,7 +1903,7 @@
19061903
<span class="kw">use </span>uucore::fs::{
19071904
canonicalize, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode,
19081905
};
1909-
<span class="kw">use </span>uucore::{crash, format_usage, prompt_yes, show_error, show_warning};
1906+
<span class="kw">use </span>uucore::{crash, format_usage, help_section, help_usage, prompt_yes, show_error, show_warning};
19101907

19111908
<span class="kw">use </span><span class="kw">crate</span>::copydir::copy_directory;
19121909

@@ -2094,13 +2091,10 @@
20942091
progress_bar: bool,
20952092
}
20962093

2097-
<span class="kw">static </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="string">&quot;Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.&quot;</span>;
2094+
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_section!</span>(<span class="string">&quot;about&quot;</span>, <span class="string">&quot;cp.md&quot;</span>);
20982095
<span class="kw">static </span>EXIT_ERR: i32 = <span class="number">1</span>;
20992096

2100-
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;\
2101-
{} [OPTION]... [-T] SOURCE DEST
2102-
{} [OPTION]... SOURCE... DIRECTORY
2103-
{} [OPTION]... -t DIRECTORY SOURCE...&quot;</span>;
2097+
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;cp.md&quot;</span>);
21042098

21052099
<span class="comment">// Argument constants
21062100
</span><span class="kw">mod </span>options {

dev/src/uu_tail/args.rs.html

+21-11
Original file line numberDiff line numberDiff line change
@@ -515,18 +515,24 @@
515515
<a href="#515" id="515">515</a>
516516
<a href="#516" id="516">516</a>
517517
<a href="#517" id="517">517</a>
518+
<a href="#518" id="518">518</a>
519+
<a href="#519" id="519">519</a>
520+
<a href="#520" id="520">520</a>
521+
<a href="#521" id="521">521</a>
522+
<a href="#522" id="522">522</a>
518523
</pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
519524
// *
520525
// * For the full copyright and license information, please view the LICENSE
521526
// * file that was distributed with this source code.
522527

523-
// spell-checker:ignore (ToDO) kqueue Signum
528+
// spell-checker:ignore (ToDO) kqueue Signum fundu
524529

525530
</span><span class="kw">use </span><span class="kw">crate</span>::paths::Input;
526531
<span class="kw">use crate</span>::{parse, platform, Quotable};
527532
<span class="kw">use </span>atty::Stream;
528533
<span class="kw">use </span>clap::crate_version;
529534
<span class="kw">use </span>clap::{parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
535+
<span class="kw">use </span>fundu::DurationParser;
530536
<span class="kw">use </span>same_file::Handle;
531537
<span class="kw">use </span>std::collections::VecDeque;
532538
<span class="kw">use </span>std::ffi::OsString;
@@ -665,16 +671,20 @@
665671
settings.retry =
666672
matches.get_flag(options::RETRY) || matches.get_flag(options::FOLLOW_RETRY);
667673

668-
<span class="kw">if let </span><span class="prelude-val">Some</span>(s) = matches.get_one::&lt;String&gt;(options::SLEEP_INT) {
669-
settings.sleep_sec = <span class="kw">match </span>s.parse::&lt;f32&gt;() {
670-
<span class="prelude-val">Ok</span>(s) =&gt; Duration::from_secs_f32(s),
671-
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; {
672-
<span class="kw">return </span><span class="prelude-val">Err</span>(UUsageError::new(
673-
<span class="number">1</span>,
674-
<span class="macro">format!</span>(<span class="string">&quot;invalid number of seconds: {}&quot;</span>, s.quote()),
675-
))
676-
}
677-
}
674+
<span class="kw">if let </span><span class="prelude-val">Some</span>(source) = matches.get_one::&lt;String&gt;(options::SLEEP_INT) {
675+
<span class="comment">// Advantage of `fundu` over `Duration::(try_)from_secs_f64(source.parse().unwrap())`:
676+
// * doesn&#39;t panic on errors like `Duration::from_secs_f64` would.
677+
// * no precision loss, rounding errors or other floating point problems.
678+
// * evaluates to `Duration::MAX` if the parsed number would have exceeded
679+
// `DURATION::MAX` or `infinity` was given
680+
// * not applied here but it supports customizable time units and provides better error
681+
// messages
682+
</span>settings.sleep_sec =
683+
DurationParser::without_time_units()
684+
.parse(source)
685+
.map_err(|<span class="kw">_</span>| {
686+
UUsageError::new(<span class="number">1</span>, <span class="macro">format!</span>(<span class="string">&quot;invalid number of seconds: &#39;{source}&#39;&quot;</span>))
687+
})<span class="question-mark">?</span>;
678688
}
679689

680690
settings.use_polling = matches.get_flag(options::USE_POLLING);

dev/uu_cat/fn.uu_app.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `uu_app` fn in crate `uu_cat`."><meta name="keywords" content="rust, rustlang, rust-lang, uu_app"><title>uu_app in uu_cat - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-6827029ac823cab7.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../static.files/ayu-8af5e100b21cd173.css"><script id="default-settings" ></script><script src="../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-c55e1eb52e1886b4.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../uu_cat/index.html"><div class="logo-container"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../uu_cat/index.html"><div class="logo-container"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></div></a><div class="sidebar-elems"><h2><a href="index.html">In uu_cat</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Function <a href="index.html">uu_cat</a>::<wbr><a class="fn" href="#">uu_app</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/uu_cat/cat.rs.html#236-311">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><div class="item-decl"><pre class="rust fn"><code>pub fn uu_app() -&gt; Command</code></pre></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="uu_cat" data-themes="" data-resource-suffix="" data-rustdoc-version="1.67.1 (d5a82bbd2 2023-02-07)" data-search-js="search-444266647c4dba98.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-af96d9e2fc13e081.css" ></div></body></html>
1+
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `uu_app` fn in crate `uu_cat`."><meta name="keywords" content="rust, rustlang, rust-lang, uu_app"><title>uu_app in uu_cat - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-6827029ac823cab7.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../static.files/ayu-8af5e100b21cd173.css"><script id="default-settings" ></script><script src="../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-c55e1eb52e1886b4.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../uu_cat/index.html"><div class="logo-container"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../uu_cat/index.html"><div class="logo-container"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></div></a><div class="sidebar-elems"><h2><a href="index.html">In uu_cat</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Function <a href="index.html">uu_cat</a>::<wbr><a class="fn" href="#">uu_app</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/uu_cat/cat.rs.html#235-310">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><div class="item-decl"><pre class="rust fn"><code>pub fn uu_app() -&gt; Command</code></pre></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="uu_cat" data-themes="" data-resource-suffix="" data-rustdoc-version="1.67.1 (d5a82bbd2 2023-02-07)" data-search-js="search-444266647c4dba98.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-af96d9e2fc13e081.css" ></div></body></html>

0 commit comments

Comments
 (0)