This commit is contained in:
sylvestre
2023-03-08 02:57:40 +00:00
parent 69c26512f5
commit 023eb73fd9
12 changed files with 36 additions and 68 deletions
+5 -5
View File
@@ -831,7 +831,7 @@
<span class="kw">use </span>regex::Regex;
<span class="kw">use </span>uucore::display::Quotable;
<span class="kw">use </span>uucore::error::{FromIo, UResult};
<span class="kw">use </span>uucore::{crash_if_err, format_usage};
<span class="kw">use </span>uucore::{crash_if_err, format_usage, help_about, help_section, help_usage};
<span class="kw">mod </span>csplit_error;
<span class="kw">mod </span>patterns;
@@ -840,9 +840,9 @@
<span class="kw">use </span><span class="kw">crate</span>::csplit_error::CsplitError;
<span class="kw">use </span><span class="kw">crate</span>::split_name::SplitName;
<span class="kw">static </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="string">&quot;Split a file into sections determined by context lines&quot;</span>;
<span class="kw">static </span>LONG_HELP: <span class="kw-2">&amp;</span>str = <span class="string">&quot;Output pieces of FILE separated by PATTERN(s) to files &#39;xx00&#39;, &#39;xx01&#39;, ..., and output byte counts of each piece to standard output.&quot;</span>;
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;{} [OPTION]... FILE PATTERN...&quot;</span>;
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_about!</span>(<span class="string">&quot;csplit.md&quot;</span>);
<span class="kw">const </span>AFTER_HELP: <span class="kw-2">&amp;</span>str = <span class="macro">help_section!</span>(<span class="string">&quot;after help&quot;</span>, <span class="string">&quot;csplit.md&quot;</span>);
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;csplit.md&quot;</span>);
<span class="kw">mod </span>options {
<span class="kw">pub const </span>SUFFIX_FORMAT: <span class="kw-2">&amp;</span>str = <span class="string">&quot;suffix-format&quot;</span>;
@@ -1632,7 +1632,7 @@
.action(clap::ArgAction::Append)
.required(<span class="bool-val">true</span>),
)
.after_help(LONG_HELP)
.after_help(AFTER_HELP)
}
</code></pre></div>
</section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="uu_csplit" 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>
+4 -38
View File
@@ -166,23 +166,6 @@
<a href="#166" id="166">166</a>
<a href="#167" id="167">167</a>
<a href="#168" id="168">168</a>
<a href="#169" id="169">169</a>
<a href="#170" id="170">170</a>
<a href="#171" id="171">171</a>
<a href="#172" id="172">172</a>
<a href="#173" id="173">173</a>
<a href="#174" id="174">174</a>
<a href="#175" id="175">175</a>
<a href="#176" id="176">176</a>
<a href="#177" id="177">177</a>
<a href="#178" id="178">178</a>
<a href="#179" id="179">179</a>
<a href="#180" id="180">180</a>
<a href="#181" id="181">181</a>
<a href="#182" id="182">182</a>
<a href="#183" id="183">183</a>
<a href="#184" id="184">184</a>
<a href="#185" id="185">185</a>
</pre><pre class="rust"><code><span class="comment">// This file is part of the uutils coreutils package.
//
// (c) Derek Chiang &lt;derekchiang93@gmail.com&gt;
@@ -196,28 +179,11 @@
<span class="kw">use </span>std::iter::Peekable;
<span class="kw">use </span>std::str::Chars;
<span class="kw">use </span>uucore::error::{FromIo, UResult};
<span class="kw">use </span>uucore::format_usage;
<span class="kw">use </span>uucore::{format_usage, help_about, help_section, help_usage};
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="string">&quot;Display a line of text&quot;</span>;
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;{} [OPTIONS]... [STRING]...&quot;</span>;
<span class="kw">const </span>AFTER_HELP: <span class="kw-2">&amp;</span>str = <span class="string">r#&quot;
Echo the STRING(s) to standard output.
If -e is in effect, the following sequences are recognized:
\\\\ backslash
\\a alert (BEL)
\\b backspace
\\c produce no further output
\\e escape
\\f form feed
\\n new line
\\r carriage return
\\t horizontal tab
\\v vertical tab
\\0NNN byte with octal value NNN (1 to 3 digits)
\\xHH byte with hexadecimal value HH (1 to 2 digits)
&quot;#</span>;
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_about!</span>(<span class="string">&quot;echo.md&quot;</span>);
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;echo.md&quot;</span>);
<span class="kw">const </span>AFTER_HELP: <span class="kw-2">&amp;</span>str = <span class="macro">help_section!</span>(<span class="string">&quot;after help&quot;</span>, <span class="string">&quot;echo.md&quot;</span>);
<span class="kw">mod </span>options {
<span class="kw">pub const </span>STRING: <span class="kw-2">&amp;</span>str = <span class="string">&quot;STRING&quot;</span>;
+3 -3
View File
@@ -187,11 +187,11 @@
<span class="kw">use </span>uucore::{
error::{FromIo, UResult},
format_usage,
format_usage, help_about, help_usage,
};
<span class="kw">static </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="string">&quot;Display or set the system&#39;s host name.&quot;</span>;
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;{} [OPTION]... [HOSTNAME]&quot;</span>;
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_about!</span>(<span class="string">&quot;hostname.md&quot;</span>);
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;hostname.md&quot;</span>);
<span class="kw">static </span>OPT_DOMAIN: <span class="kw-2">&amp;</span>str = <span class="string">&quot;domain&quot;</span>;
<span class="kw">static </span>OPT_IP_ADDRESS: <span class="kw-2">&amp;</span>str = <span class="string">&quot;ip-address&quot;</span>;
+3 -5
View File
@@ -867,7 +867,6 @@
<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>
</pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
// *
// * (c) Ben Eills &lt;ben@beneills.com&gt;
@@ -889,7 +888,7 @@
<span class="kw">use </span>uucore::fs::dir_strip_dot_for_creation;
<span class="kw">use </span>uucore::mode::get_umask;
<span class="kw">use </span>uucore::perms::{wrap_chown, Verbosity, VerbosityLevel};
<span class="kw">use </span>uucore::{format_usage, show, show_error, show_if_err, uio_error};
<span class="kw">use </span>uucore::{format_usage, help_about, help_usage, show, show_error, show_if_err, uio_error};
<span class="kw">use </span>libc::{getegid, geteuid};
<span class="kw">use </span>std::error::Error;
@@ -1014,9 +1013,8 @@
}
}
<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 the existing
DIRECTORY, while setting permission modes and owner/group&quot;</span>;
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;{} [OPTION]... [FILE]...&quot;</span>;
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_about!</span>(<span class="string">&quot;install.md&quot;</span>);
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;install.md&quot;</span>);
<span class="kw">static </span>OPT_COMPARE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;compare&quot;</span>;
<span class="kw">static </span>OPT_DIRECTORY: <span class="kw-2">&amp;</span>str = <span class="string">&quot;directory&quot;</span>;
+14 -10
View File
@@ -76,6 +76,8 @@
<a href="#76" id="76">76</a>
<a href="#77" id="77">77</a>
<a href="#78" id="78">78</a>
<a href="#79" id="79">79</a>
<a href="#80" id="80">80</a>
</pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon &lt;arcterus@mail.com&gt;
@@ -88,7 +90,7 @@
<span class="kw">use </span>uucore::{
error::{UResult, USimpleError, UUsageError},
format_usage, help_about, help_section, help_usage, show,
format_usage, help_about, help_section, help_usage, show_error,
};
<span class="kw">use </span>clap::{crate_version, Arg, ArgAction, Command};
@@ -139,15 +141,17 @@
<span class="kw">fn </span>sleep(args: <span class="kw-2">&amp;</span>[<span class="kw-2">&amp;</span>str]) -&gt; UResult&lt;()&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>arg_error = <span class="bool-val">false</span>;
<span class="kw">let </span>intervals = args.iter().map(|s| <span class="kw">match </span>uucore::parse_time::from_str(s) {
<span class="prelude-val">Ok</span>(result) =&gt; result,
<span class="prelude-val">Err</span>(err) =&gt; {
arg_error = <span class="bool-val">true</span>;
<span class="macro">show!</span>(USimpleError::new(<span class="number">1</span>, err));
Duration::new(<span class="number">0</span>, <span class="number">0</span>)
}
});
<span class="kw">let </span>sleep_dur = intervals.fold(Duration::new(<span class="number">0</span>, <span class="number">0</span>), |acc, n| acc + n);
<span class="kw">let </span>sleep_dur = args
.iter()
.filter_map(|input| {
uucore::parse_time::from_str(input.trim()).ok().or_else(|| {
arg_error = <span class="bool-val">true</span>;
<span class="macro">show_error!</span>(<span class="string">&quot;invalid time interval &#39;{input}&#39;&quot;</span>);
<span class="prelude-val">None
</span>})
})
.fold(Duration::ZERO, |acc, n| acc.saturating_add(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">&quot;&quot;</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
File diff suppressed because one or more lines are too long