This commit is contained in:
sylvestre
2023-06-25 03:14:45 +00:00
parent 5fdaa0907c
commit 96ec17c994
33 changed files with 67 additions and 60 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,5 @@
(function() {var implementors = {
"uu_nl":[["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_nl/struct.Settings.html\" title=\"struct uu_nl::Settings\">Settings</a>"]],
"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>"]],
+2 -2
View File
File diff suppressed because one or more lines are too long
+24 -18
View File
@@ -401,6 +401,9 @@
<a href="#401" id="401">401</a>
<a href="#402" id="402">402</a>
<a href="#403" id="403">403</a>
<a href="#404" id="404">404</a>
<a href="#405" id="405">405</a>
<a href="#406" id="406">406</a>
</pre></div><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
// *
// * (c) Tobias Bohumir Schottdorf &lt;tobias.schottdorf@gmail.com&gt;
@@ -409,8 +412,6 @@
// * file that was distributed with this source code.
// *
// spell-checker:ignore (ToDO) corasick memchr
</span><span class="kw">use </span>clap::{crate_version, Arg, ArgAction, Command};
<span class="kw">use </span>std::fs::File;
<span class="kw">use </span>std::io::{stdin, BufRead, BufReader, Read};
@@ -421,8 +422,8 @@
<span class="kw">mod </span>helper;
<span class="kw">static </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_about!</span>(<span class="string">&quot;nl.md&quot;</span>);
<span class="kw">static </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;nl.md&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;nl.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;nl.md&quot;</span>);
<span class="comment">// Settings store options used by nl to produce its output.
</span><span class="kw">pub struct </span>Settings {
@@ -445,6 +446,24 @@
</span>number_separator: String,
}
<span class="kw">impl </span>Default <span class="kw">for </span>Settings {
<span class="kw">fn </span>default() -&gt; <span class="self">Self </span>{
<span class="self">Self </span>{
header_numbering: NumberingStyle::NumberForNone,
body_numbering: NumberingStyle::NumberForAll,
footer_numbering: NumberingStyle::NumberForNone,
section_delimiter: [<span class="string">&#39;\\&#39;</span>, <span class="string">&#39;:&#39;</span>],
starting_line_number: <span class="number">1</span>,
line_increment: <span class="number">1</span>,
join_blank_lines: <span class="number">1</span>,
number_width: <span class="number">6</span>,
number_format: NumberFormat::Right,
renumber: <span class="bool-val">true</span>,
number_separator: String::from(<span class="string">&quot;\t&quot;</span>),
}
}
}
<span class="comment">// NumberingStyle stores which lines are to be numbered.
// The possible options are:
// 1. Number all lines
@@ -490,20 +509,7 @@
<span class="kw">let </span>matches = uu_app().try_get_matches_from(args)<span class="question-mark">?</span>;
<span class="comment">// A mutable settings object, initialized with the defaults.
</span><span class="kw">let </span><span class="kw-2">mut </span>settings = Settings {
header_numbering: NumberingStyle::NumberForNone,
body_numbering: NumberingStyle::NumberForAll,
footer_numbering: NumberingStyle::NumberForNone,
section_delimiter: [<span class="string">&#39;\\&#39;</span>, <span class="string">&#39;:&#39;</span>],
starting_line_number: <span class="number">1</span>,
line_increment: <span class="number">1</span>,
join_blank_lines: <span class="number">1</span>,
number_width: <span class="number">6</span>,
number_format: NumberFormat::Right,
renumber: <span class="bool-val">true</span>,
number_separator: String::from(<span class="string">&quot;\t&quot;</span>),
};
<span class="kw">let </span><span class="kw-2">mut </span>settings = Settings::default();
<span class="comment">// Update the settings from the command line options, and terminate the
// program if some options could not successfully be parsed.
+12 -12
View File
@@ -615,7 +615,7 @@
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
// spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm clapv PWSTR lpszfilepath hresult mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond humantime
// spell-checker:ignore (ToDO) filetime datetime MMDDhhmm lpszfilepath mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond humantime
</span><span class="kw">use </span>clap::builder::ValueParser;
<span class="kw">use </span>clap::{crate_version, Arg, ArgAction, ArgGroup, Command};
@@ -638,7 +638,7 @@
<span class="kw">pub mod </span>sources {
<span class="kw">pub static </span>DATE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;date&quot;</span>;
<span class="kw">pub static </span>REFERENCE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;reference&quot;</span>;
<span class="kw">pub static </span>CURRENT: <span class="kw-2">&amp;</span>str = <span class="string">&quot;current&quot;</span>;
<span class="kw">pub static </span>TIMESTAMP: <span class="kw-2">&amp;</span>str = <span class="string">&quot;timestamp&quot;</span>;
}
<span class="kw">pub static </span>HELP: <span class="kw-2">&amp;</span>str = <span class="string">&quot;help&quot;</span>;
<span class="kw">pub static </span>ACCESS: <span class="kw-2">&amp;</span>str = <span class="string">&quot;access&quot;</span>;
@@ -729,12 +729,12 @@
(timestamp, timestamp)
}
(<span class="prelude-val">None</span>, <span class="prelude-val">None</span>) =&gt; {
<span class="kw">let </span>timestamp =
<span class="kw">if let </span><span class="prelude-val">Some</span>(current) = matches.get_one::&lt;String&gt;(options::sources::CURRENT) {
parse_timestamp(current)<span class="question-mark">?
</span>} <span class="kw">else </span>{
local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap())
};
<span class="kw">let </span>timestamp = <span class="kw">if let </span><span class="prelude-val">Some</span>(ts) = matches.get_one::&lt;String&gt;(options::sources::TIMESTAMP)
{
parse_timestamp(ts)<span class="question-mark">?
</span>} <span class="kw">else </span>{
local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap())
};
(timestamp, timestamp)
}
};
@@ -852,7 +852,7 @@
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::sources::CURRENT)
Arg::new(options::sources::TIMESTAMP)
.short(<span class="string">&#39;t&#39;</span>)
.help(<span class="string">&quot;use [[CC]YY]MMDDhhmm[.ss] instead of the current time&quot;</span>)
.value_name(<span class="string">&quot;STAMP&quot;</span>),
@@ -864,7 +864,7 @@
.allow_hyphen_values(<span class="bool-val">true</span>)
.help(<span class="string">&quot;parse argument and use it instead of current time&quot;</span>)
.value_name(<span class="string">&quot;STRING&quot;</span>)
.conflicts_with(options::sources::CURRENT),
.conflicts_with(options::sources::TIMESTAMP),
)
.arg(
Arg::new(options::MODIFICATION)
@@ -897,7 +897,7 @@
.value_name(<span class="string">&quot;FILE&quot;</span>)
.value_parser(ValueParser::os_string())
.value_hint(clap::ValueHint::AnyPath)
.conflicts_with(options::sources::CURRENT),
.conflicts_with(options::sources::TIMESTAMP),
)
.arg(
Arg::new(options::TIME)
@@ -920,7 +920,7 @@
.group(
ArgGroup::new(options::SOURCES)
.args([
options::sources::CURRENT,
options::sources::TIMESTAMP,
options::sources::DATE,
options::sources::REFERENCE,
])
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
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
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

Some files were not shown because too many files have changed in this diff Show More