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:
@@ -132,19 +132,6 @@
|
||||
<a href="#132" id="132">132</a>
|
||||
<a href="#133" id="133">133</a>
|
||||
<a href="#134" id="134">134</a>
|
||||
<a href="#135" id="135">135</a>
|
||||
<a href="#136" id="136">136</a>
|
||||
<a href="#137" id="137">137</a>
|
||||
<a href="#138" id="138">138</a>
|
||||
<a href="#139" id="139">139</a>
|
||||
<a href="#140" id="140">140</a>
|
||||
<a href="#141" id="141">141</a>
|
||||
<a href="#142" id="142">142</a>
|
||||
<a href="#143" id="143">143</a>
|
||||
<a href="#144" id="144">144</a>
|
||||
<a href="#145" id="145">145</a>
|
||||
<a href="#146" id="146">146</a>
|
||||
<a href="#147" id="147">147</a>
|
||||
</pre></div><pre class="rust"><code><span class="comment">// spell-checker:ignore (ToDO) conv
|
||||
|
||||
</span><span class="kw">use </span><span class="kw">crate</span>::options;
|
||||
@@ -183,23 +170,10 @@
|
||||
settings.number_separator = val.to_owned();
|
||||
}
|
||||
}
|
||||
<span class="kw">match </span>opts.get_one::<String>(options::NUMBER_FORMAT) {
|
||||
<span class="prelude-val">None </span>=> {}
|
||||
<span class="prelude-val">Some</span>(val) => <span class="kw">match </span>val.as_str() {
|
||||
<span class="string">"ln" </span>=> {
|
||||
settings.number_format = <span class="kw">crate</span>::NumberFormat::Left;
|
||||
}
|
||||
<span class="string">"rn" </span>=> {
|
||||
settings.number_format = <span class="kw">crate</span>::NumberFormat::Right;
|
||||
}
|
||||
<span class="string">"rz" </span>=> {
|
||||
settings.number_format = <span class="kw">crate</span>::NumberFormat::RightZero;
|
||||
}
|
||||
<span class="kw">_ </span>=> {
|
||||
errs.push(String::from(<span class="string">"Illegal value for -n"</span>));
|
||||
}
|
||||
},
|
||||
}
|
||||
settings.number_format = opts
|
||||
.get_one::<String>(options::NUMBER_FORMAT)
|
||||
.map(Into::into)
|
||||
.unwrap_or_default();
|
||||
<span class="kw">match </span>opts.get_one::<String>(options::BODY_NUMBERING) {
|
||||
<span class="prelude-val">None </span>=> {}
|
||||
<span class="prelude-val">Some</span>(val) => {
|
||||
|
||||
@@ -405,6 +405,22 @@
|
||||
<a href="#405" id="405">405</a>
|
||||
<a href="#406" id="406">406</a>
|
||||
<a href="#407" id="407">407</a>
|
||||
<a href="#408" id="408">408</a>
|
||||
<a href="#409" id="409">409</a>
|
||||
<a href="#410" id="410">410</a>
|
||||
<a href="#411" id="411">411</a>
|
||||
<a href="#412" id="412">412</a>
|
||||
<a href="#413" id="413">413</a>
|
||||
<a href="#414" id="414">414</a>
|
||||
<a href="#415" id="415">415</a>
|
||||
<a href="#416" id="416">416</a>
|
||||
<a href="#417" id="417">417</a>
|
||||
<a href="#418" id="418">418</a>
|
||||
<a href="#419" id="419">419</a>
|
||||
<a href="#420" id="420">420</a>
|
||||
<a href="#421" id="421">421</a>
|
||||
<a href="#422" id="422">422</a>
|
||||
<a href="#423" id="423">423</a>
|
||||
</pre></div><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
|
||||
// *
|
||||
// * (c) Tobias Bohumir Schottdorf <tobias.schottdorf@gmail.com>
|
||||
@@ -419,11 +435,12 @@
|
||||
<span class="kw">use </span>std::iter::repeat;
|
||||
<span class="kw">use </span>std::path::Path;
|
||||
<span class="kw">use </span>uucore::error::{FromIo, UResult, USimpleError};
|
||||
<span class="kw">use </span>uucore::{format_usage, help_about, help_usage};
|
||||
<span class="kw">use </span>uucore::{format_usage, help_about, help_section, help_usage};
|
||||
|
||||
<span class="kw">mod </span>helper;
|
||||
|
||||
<span class="kw">const </span>ABOUT: <span class="kw-2">&</span>str = <span class="macro">help_about!</span>(<span class="string">"nl.md"</span>);
|
||||
<span class="kw">const </span>AFTER_HELP: <span class="kw-2">&</span>str = <span class="macro">help_section!</span>(<span class="string">"after help"</span>, <span class="string">"nl.md"</span>);
|
||||
<span class="kw">const </span>USAGE: <span class="kw-2">&</span>str = <span class="macro">help_usage!</span>(<span class="string">"nl.md"</span>);
|
||||
|
||||
<span class="comment">// Settings store options used by nl to produce its output.
|
||||
@@ -482,12 +499,25 @@
|
||||
<span class="comment">// NumberFormat specifies how line numbers are output within their allocated
|
||||
// space. They are justified to the left or right, in the latter case with
|
||||
// the option of having all unused space to its left turned into leading zeroes.
|
||||
</span><span class="attr">#[derive(Default)]
|
||||
</span><span class="kw">enum </span>NumberFormat {
|
||||
Left,
|
||||
Right,
|
||||
<span class="attr">#[default]
|
||||
</span>Right,
|
||||
RightZero,
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><T: AsRef<str>> From<T> <span class="kw">for </span>NumberFormat {
|
||||
<span class="kw">fn </span>from(s: T) -> <span class="self">Self </span>{
|
||||
<span class="kw">match </span>s.as_ref() {
|
||||
<span class="string">"ln" </span>=> <span class="self">Self</span>::Left,
|
||||
<span class="string">"rn" </span>=> <span class="self">Self</span>::Right,
|
||||
<span class="string">"rz" </span>=> <span class="self">Self</span>::RightZero,
|
||||
<span class="kw">_ </span>=> <span class="macro">unreachable!</span>(<span class="string">"Should have been caught by clap"</span>),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">pub mod </span>options {
|
||||
<span class="kw">pub const </span>HELP: <span class="kw-2">&</span>str = <span class="string">"help"</span>;
|
||||
<span class="kw">pub const </span>FILE: <span class="kw-2">&</span>str = <span class="string">"file"</span>;
|
||||
@@ -553,6 +583,7 @@
|
||||
.about(ABOUT)
|
||||
.version(<span class="macro">crate_version!</span>())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.infer_long_args(<span class="bool-val">true</span>)
|
||||
.disable_help_flag(<span class="bool-val">true</span>)
|
||||
.arg(
|
||||
@@ -614,7 +645,8 @@
|
||||
.short(<span class="string">'n'</span>)
|
||||
.long(options::NUMBER_FORMAT)
|
||||
.help(<span class="string">"insert line numbers according to FORMAT"</span>)
|
||||
.value_name(<span class="string">"FORMAT"</span>),
|
||||
.value_name(<span class="string">"FORMAT"</span>)
|
||||
.value_parser([<span class="string">"ln"</span>, <span class="string">"rn"</span>, <span class="string">"rz"</span>]),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::NO_RENUMBER)
|
||||
|
||||
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
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
Reference in New Issue
Block a user