pub fn uu_app() -> Commanddiff --git a/dev/src/uu_nl/helper.rs.html b/dev/src/uu_nl/helper.rs.html index 348ce77ef..5e404809e 100644 --- a/dev/src/uu_nl/helper.rs.html +++ b/dev/src/uu_nl/helper.rs.html @@ -132,19 +132,6 @@ 132 133 134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147
// spell-checker:ignore (ToDO) conv
use crate::options;
@@ -183,23 +170,10 @@
settings.number_separator = val.to_owned();
}
}
- match opts.get_one::<String>(options::NUMBER_FORMAT) {
- None => {}
- Some(val) => match val.as_str() {
- "ln" => {
- settings.number_format = crate::NumberFormat::Left;
- }
- "rn" => {
- settings.number_format = crate::NumberFormat::Right;
- }
- "rz" => {
- settings.number_format = crate::NumberFormat::RightZero;
- }
- _ => {
- errs.push(String::from("Illegal value for -n"));
- }
- },
- }
+ settings.number_format = opts
+ .get_one::<String>(options::NUMBER_FORMAT)
+ .map(Into::into)
+ .unwrap_or_default();
match opts.get_one::<String>(options::BODY_NUMBERING) {
None => {}
Some(val) => {
diff --git a/dev/src/uu_nl/nl.rs.html b/dev/src/uu_nl/nl.rs.html
index 9be0d707d..f35a24299 100644
--- a/dev/src/uu_nl/nl.rs.html
+++ b/dev/src/uu_nl/nl.rs.html
@@ -405,6 +405,22 @@
405
406
407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
// * This file is part of the uutils coreutils package.
// *
// * (c) Tobias Bohumir Schottdorf <tobias.schottdorf@gmail.com>
@@ -419,11 +435,12 @@
use std::iter::repeat;
use std::path::Path;
use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::{format_usage, help_about, help_usage};
+use uucore::{format_usage, help_about, help_section, help_usage};
mod helper;
const ABOUT: &str = help_about!("nl.md");
+const AFTER_HELP: &str = help_section!("after help", "nl.md");
const USAGE: &str = help_usage!("nl.md");
// Settings store options used by nl to produce its output.
@@ -482,12 +499,25 @@
// 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.
+#[derive(Default)]
enum NumberFormat {
Left,
- Right,
+ #[default]
+ Right,
RightZero,
}
+impl<T: AsRef<str>> From<T> for NumberFormat {
+ fn from(s: T) -> Self {
+ match s.as_ref() {
+ "ln" => Self::Left,
+ "rn" => Self::Right,
+ "rz" => Self::RightZero,
+ _ => unreachable!("Should have been caught by clap"),
+ }
+ }
+}
+
pub mod options {
pub const HELP: &str = "help";
pub const FILE: &str = "file";
@@ -553,6 +583,7 @@
.about(ABOUT)
.version(crate_version!())
.override_usage(format_usage(USAGE))
+ .after_help(AFTER_HELP)
.infer_long_args(true)
.disable_help_flag(true)
.arg(
@@ -614,7 +645,8 @@
.short('n')
.long(options::NUMBER_FORMAT)
.help("insert line numbers according to FORMAT")
- .value_name("FORMAT"),
+ .value_name("FORMAT")
+ .value_parser(["ln", "rn", "rz"]),
)
.arg(
Arg::new(options::NO_RENUMBER)
diff --git a/dev/uu_nl/fn.uu_app.html b/dev/uu_nl/fn.uu_app.html
index e70aabcf8..4a11f3f6d 100644
--- a/dev/uu_nl/fn.uu_app.html
+++ b/dev/uu_nl/fn.uu_app.html
@@ -1 +1 @@
-uu_app in uu_nl - Rust
\ No newline at end of file
+uu_app in uu_nl - Rust
\ No newline at end of file
diff --git a/dev/uu_nl/fn.uumain.html b/dev/uu_nl/fn.uumain.html
index ebf9e38bd..98a90d1d1 100644
--- a/dev/uu_nl/fn.uumain.html
+++ b/dev/uu_nl/fn.uumain.html
@@ -1 +1 @@
-uumain in uu_nl - Rust
\ No newline at end of file
+uumain in uu_nl - Rust
\ No newline at end of file
diff --git a/dev/uu_nl/index.html b/dev/uu_nl/index.html
index 06599015b..1c71d85b3 100644
--- a/dev/uu_nl/index.html
+++ b/dev/uu_nl/index.html
@@ -1 +1 @@
-uu_nl - Rust
\ No newline at end of file
+uu_nl - Rust
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.BODY_NUMBERING.html b/dev/uu_nl/options/constant.BODY_NUMBERING.html
index 997e8cdb5..70618d8e5 100644
--- a/dev/uu_nl/options/constant.BODY_NUMBERING.html
+++ b/dev/uu_nl/options/constant.BODY_NUMBERING.html
@@ -1 +1 @@
-BODY_NUMBERING in uu_nl::options - Rust Constant uu_nl::options::BODY_NUMBERING
source · pub const BODY_NUMBERING: &str = "body-numbering";
\ No newline at end of file
+BODY_NUMBERING in uu_nl::options - Rust Constant uu_nl::options::BODY_NUMBERING
source · pub const BODY_NUMBERING: &str = "body-numbering";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.FILE.html b/dev/uu_nl/options/constant.FILE.html
index 6d114f21b..52e9983e3 100644
--- a/dev/uu_nl/options/constant.FILE.html
+++ b/dev/uu_nl/options/constant.FILE.html
@@ -1 +1 @@
-FILE in uu_nl::options - Rust
\ No newline at end of file
+FILE in uu_nl::options - Rust
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.FOOTER_NUMBERING.html b/dev/uu_nl/options/constant.FOOTER_NUMBERING.html
index c87b236f3..428891fc6 100644
--- a/dev/uu_nl/options/constant.FOOTER_NUMBERING.html
+++ b/dev/uu_nl/options/constant.FOOTER_NUMBERING.html
@@ -1 +1 @@
-FOOTER_NUMBERING in uu_nl::options - Rust Constant uu_nl::options::FOOTER_NUMBERING
source · pub const FOOTER_NUMBERING: &str = "footer-numbering";
\ No newline at end of file
+FOOTER_NUMBERING in uu_nl::options - Rust Constant uu_nl::options::FOOTER_NUMBERING
source · pub const FOOTER_NUMBERING: &str = "footer-numbering";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.HEADER_NUMBERING.html b/dev/uu_nl/options/constant.HEADER_NUMBERING.html
index 52bdd942b..67f823980 100644
--- a/dev/uu_nl/options/constant.HEADER_NUMBERING.html
+++ b/dev/uu_nl/options/constant.HEADER_NUMBERING.html
@@ -1 +1 @@
-HEADER_NUMBERING in uu_nl::options - Rust Constant uu_nl::options::HEADER_NUMBERING
source · pub const HEADER_NUMBERING: &str = "header-numbering";
\ No newline at end of file
+HEADER_NUMBERING in uu_nl::options - Rust Constant uu_nl::options::HEADER_NUMBERING
source · pub const HEADER_NUMBERING: &str = "header-numbering";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.HELP.html b/dev/uu_nl/options/constant.HELP.html
index a2bb8ec38..e709e4ec9 100644
--- a/dev/uu_nl/options/constant.HELP.html
+++ b/dev/uu_nl/options/constant.HELP.html
@@ -1 +1 @@
-HELP in uu_nl::options - Rust
\ No newline at end of file
+HELP in uu_nl::options - Rust
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.JOIN_BLANK_LINES.html b/dev/uu_nl/options/constant.JOIN_BLANK_LINES.html
index 0244d92cb..59b0fc702 100644
--- a/dev/uu_nl/options/constant.JOIN_BLANK_LINES.html
+++ b/dev/uu_nl/options/constant.JOIN_BLANK_LINES.html
@@ -1 +1 @@
-JOIN_BLANK_LINES in uu_nl::options - Rust Constant uu_nl::options::JOIN_BLANK_LINES
source · pub const JOIN_BLANK_LINES: &str = "join-blank-lines";
\ No newline at end of file
+JOIN_BLANK_LINES in uu_nl::options - Rust Constant uu_nl::options::JOIN_BLANK_LINES
source · pub const JOIN_BLANK_LINES: &str = "join-blank-lines";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.LINE_INCREMENT.html b/dev/uu_nl/options/constant.LINE_INCREMENT.html
index 601fbb82e..e84ae58cc 100644
--- a/dev/uu_nl/options/constant.LINE_INCREMENT.html
+++ b/dev/uu_nl/options/constant.LINE_INCREMENT.html
@@ -1 +1 @@
-LINE_INCREMENT in uu_nl::options - Rust Constant uu_nl::options::LINE_INCREMENT
source · pub const LINE_INCREMENT: &str = "line-increment";
\ No newline at end of file
+LINE_INCREMENT in uu_nl::options - Rust Constant uu_nl::options::LINE_INCREMENT
source · pub const LINE_INCREMENT: &str = "line-increment";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.NO_RENUMBER.html b/dev/uu_nl/options/constant.NO_RENUMBER.html
index 45a3c426b..0b2015ca9 100644
--- a/dev/uu_nl/options/constant.NO_RENUMBER.html
+++ b/dev/uu_nl/options/constant.NO_RENUMBER.html
@@ -1 +1 @@
-NO_RENUMBER in uu_nl::options - Rust Constant uu_nl::options::NO_RENUMBER
source · pub const NO_RENUMBER: &str = "no-renumber";
\ No newline at end of file
+NO_RENUMBER in uu_nl::options - Rust Constant uu_nl::options::NO_RENUMBER
source · pub const NO_RENUMBER: &str = "no-renumber";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.NUMBER_FORMAT.html b/dev/uu_nl/options/constant.NUMBER_FORMAT.html
index 19c6888c8..24bcff618 100644
--- a/dev/uu_nl/options/constant.NUMBER_FORMAT.html
+++ b/dev/uu_nl/options/constant.NUMBER_FORMAT.html
@@ -1 +1 @@
-NUMBER_FORMAT in uu_nl::options - Rust Constant uu_nl::options::NUMBER_FORMAT
source · pub const NUMBER_FORMAT: &str = "number-format";
\ No newline at end of file
+NUMBER_FORMAT in uu_nl::options - Rust Constant uu_nl::options::NUMBER_FORMAT
source · pub const NUMBER_FORMAT: &str = "number-format";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.NUMBER_SEPARATOR.html b/dev/uu_nl/options/constant.NUMBER_SEPARATOR.html
index 9cca15cf1..9d259c674 100644
--- a/dev/uu_nl/options/constant.NUMBER_SEPARATOR.html
+++ b/dev/uu_nl/options/constant.NUMBER_SEPARATOR.html
@@ -1 +1 @@
-NUMBER_SEPARATOR in uu_nl::options - Rust Constant uu_nl::options::NUMBER_SEPARATOR
source · pub const NUMBER_SEPARATOR: &str = "number-separator";
\ No newline at end of file
+NUMBER_SEPARATOR in uu_nl::options - Rust Constant uu_nl::options::NUMBER_SEPARATOR
source · pub const NUMBER_SEPARATOR: &str = "number-separator";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.NUMBER_WIDTH.html b/dev/uu_nl/options/constant.NUMBER_WIDTH.html
index df390efed..b3cc513cc 100644
--- a/dev/uu_nl/options/constant.NUMBER_WIDTH.html
+++ b/dev/uu_nl/options/constant.NUMBER_WIDTH.html
@@ -1 +1 @@
-NUMBER_WIDTH in uu_nl::options - Rust Constant uu_nl::options::NUMBER_WIDTH
source · pub const NUMBER_WIDTH: &str = "number-width";
\ No newline at end of file
+NUMBER_WIDTH in uu_nl::options - Rust Constant uu_nl::options::NUMBER_WIDTH
source · pub const NUMBER_WIDTH: &str = "number-width";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.SECTION_DELIMITER.html b/dev/uu_nl/options/constant.SECTION_DELIMITER.html
index 88ac65648..602c97b37 100644
--- a/dev/uu_nl/options/constant.SECTION_DELIMITER.html
+++ b/dev/uu_nl/options/constant.SECTION_DELIMITER.html
@@ -1 +1 @@
-SECTION_DELIMITER in uu_nl::options - Rust Constant uu_nl::options::SECTION_DELIMITER
source · pub const SECTION_DELIMITER: &str = "section-delimiter";
\ No newline at end of file
+SECTION_DELIMITER in uu_nl::options - Rust Constant uu_nl::options::SECTION_DELIMITER
source · pub const SECTION_DELIMITER: &str = "section-delimiter";
\ No newline at end of file
diff --git a/dev/uu_nl/options/constant.STARTING_LINE_NUMBER.html b/dev/uu_nl/options/constant.STARTING_LINE_NUMBER.html
index 63c0ec1b9..0c36c3a4c 100644
--- a/dev/uu_nl/options/constant.STARTING_LINE_NUMBER.html
+++ b/dev/uu_nl/options/constant.STARTING_LINE_NUMBER.html
@@ -1 +1 @@
-STARTING_LINE_NUMBER in uu_nl::options - Rust Constant uu_nl::options::STARTING_LINE_NUMBER
source · pub const STARTING_LINE_NUMBER: &str = "starting-line-number";
\ No newline at end of file
+STARTING_LINE_NUMBER in uu_nl::options - Rust Constant uu_nl::options::STARTING_LINE_NUMBER
source · pub const STARTING_LINE_NUMBER: &str = "starting-line-number";
\ No newline at end of file
diff --git a/dev/uu_nl/options/index.html b/dev/uu_nl/options/index.html
index 5fc7ad5dc..6f4dfa31d 100644
--- a/dev/uu_nl/options/index.html
+++ b/dev/uu_nl/options/index.html
@@ -1 +1 @@
-uu_nl::options - Rust
\ No newline at end of file
+uu_nl::options - Rust
\ No newline at end of file
diff --git a/dev/uu_nl/struct.Settings.html b/dev/uu_nl/struct.Settings.html
index 1e10455b3..405564354 100644
--- a/dev/uu_nl/struct.Settings.html
+++ b/dev/uu_nl/struct.Settings.html
@@ -1,4 +1,4 @@
-Settings in uu_nl - Rust pub struct Settings { /* private fields */ }
Trait Implementations§
Auto Trait Implementations§
§impl RefUnwindSafe for Settings
§impl Send for Settings
§impl Sync for Settings
§impl Unpin for Settings
§impl UnwindSafe for Settings
Blanket Implementations§
source§impl<T> Any for Twhere
+Settings in uu_nl - Rust pub struct Settings { /* private fields */ }
Trait Implementations§
Auto Trait Implementations§
§impl RefUnwindSafe for Settings
§impl Send for Settings
§impl Sync for Settings
§impl Unpin for Settings
§impl UnwindSafe for Settings
Blanket Implementations§