From fc4dc243f2feff7af167a6daf4178df756669874 Mon Sep 17 00:00:00 2001 From: sylvestre Date: Wed, 26 Jul 2023 02:38:31 +0000 Subject: [PATCH] deploy: f0e8d44e6e64ee3354f95864c0a25b74cf1c1151 --- dev/src/uu_nl/helper.rs.html | 36 ++++++------------- dev/src/uu_nl/nl.rs.html | 28 +++++++-------- dev/uu_nl/fn.uu_app.html | 2 +- dev/uu_nl/fn.uumain.html | 2 +- .../options/constant.BODY_NUMBERING.html | 2 +- dev/uu_nl/options/constant.FILE.html | 2 +- .../options/constant.FOOTER_NUMBERING.html | 2 +- .../options/constant.HEADER_NUMBERING.html | 2 +- dev/uu_nl/options/constant.HELP.html | 2 +- .../options/constant.JOIN_BLANK_LINES.html | 2 +- .../options/constant.LINE_INCREMENT.html | 2 +- dev/uu_nl/options/constant.NO_RENUMBER.html | 2 +- dev/uu_nl/options/constant.NUMBER_FORMAT.html | 2 +- .../options/constant.NUMBER_SEPARATOR.html | 2 +- dev/uu_nl/options/constant.NUMBER_WIDTH.html | 2 +- .../options/constant.SECTION_DELIMITER.html | 2 +- .../constant.STARTING_LINE_NUMBER.html | 2 +- dev/uu_nl/options/index.html | 2 +- 18 files changed, 41 insertions(+), 55 deletions(-) diff --git a/dev/src/uu_nl/helper.rs.html b/dev/src/uu_nl/helper.rs.html index 1228ac899..1df2c2ebe 100644 --- a/dev/src/uu_nl/helper.rs.html +++ b/dev/src/uu_nl/helper.rs.html @@ -99,13 +99,6 @@ 99 100 101 -102 -103 -104 -105 -106 -107 -108
// spell-checker:ignore (ToDO) conv
 
 use crate::options;
@@ -113,17 +106,15 @@
 // parse_style parses a style string into a NumberingStyle.
 fn parse_style(chars: &[char]) -> Result<crate::NumberingStyle, String> {
     if chars.len() == 1 && chars[0] == 'a' {
-        Ok(crate::NumberingStyle::NumberForAll)
+        Ok(crate::NumberingStyle::All)
     } else if chars.len() == 1 && chars[0] == 't' {
-        Ok(crate::NumberingStyle::NumberForNonEmpty)
+        Ok(crate::NumberingStyle::NonEmpty)
     } else if chars.len() == 1 && chars[0] == 'n' {
-        Ok(crate::NumberingStyle::NumberForNone)
+        Ok(crate::NumberingStyle::None)
     } else if chars.len() > 1 && chars[0] == 'p' {
         let s: String = chars[1..].iter().cloned().collect();
         match regex::Regex::new(&s) {
-            Ok(re) => Ok(crate::NumberingStyle::NumberForRegularExpression(Box::new(
-                re,
-            ))),
+            Ok(re) => Ok(crate::NumberingStyle::Regex(Box::new(re))),
             Err(_) => Err(String::from("Illegal regular expression")),
         }
     } else {
@@ -194,24 +185,19 @@
             "Invalid line number field width: ‘0’: Numerical result out of range",
         )),
     }
+    match opts.get_one::<u64>(options::JOIN_BLANK_LINES) {
+        None => {}
+        Some(num) if *num > 0 => settings.join_blank_lines = *num,
+        Some(_) => errs.push(String::from(
+            "Invalid line number of blank lines: ‘0’: Numerical result out of range",
+        )),
+    }
     if let Some(num) = opts.get_one::<i64>(options::LINE_INCREMENT) {
         settings.line_increment = *num;
     }
     if let Some(num) = opts.get_one::<i64>(options::STARTING_LINE_NUMBER) {
         settings.starting_line_number = *num;
     }
-    match opts.get_one::<String>(options::JOIN_BLANK_LINES) {
-        None => {}
-        Some(val) => {
-            let conv: Option<u64> = val.parse().ok();
-            match conv {
-                None => {
-                    errs.push(String::from("Illegal value for -l"));
-                }
-                Some(num) => settings.join_blank_lines = num,
-            }
-        }
-    }
     errs
 }
 
\ No newline at end of file diff --git a/dev/src/uu_nl/nl.rs.html b/dev/src/uu_nl/nl.rs.html index 7ed5cde8b..30b107656 100644 --- a/dev/src/uu_nl/nl.rs.html +++ b/dev/src/uu_nl/nl.rs.html @@ -478,9 +478,9 @@ impl Default for Settings { fn default() -> Self { Self { - header_numbering: NumberingStyle::NumberForNone, - body_numbering: NumberingStyle::NumberForAll, - footer_numbering: NumberingStyle::NumberForNone, + header_numbering: NumberingStyle::None, + body_numbering: NumberingStyle::All, + footer_numbering: NumberingStyle::None, section_delimiter: ['\\', ':'], starting_line_number: 1, line_increment: 1, @@ -499,12 +499,11 @@ // 2. Number only nonempty lines // 3. Don't number any lines at all // 4. Number all lines that match a basic regular expression. -#[allow(clippy::enum_variant_names)] enum NumberingStyle { - NumberForAll, - NumberForNonEmpty, - NumberForNone, - NumberForRegularExpression(Box<regex::Regex>), + All, + NonEmpty, + None, + Regex(Box<regex::Regex>), } // NumberFormat specifies how line numbers are output within their allocated @@ -663,7 +662,8 @@ .short('l') .long(options::JOIN_BLANK_LINES) .help("group of NUMBER empty lines counted as one") - .value_name("NUMBER"), + .value_name("NUMBER") + .value_parser(clap::value_parser!(u64)), ) .arg( Arg::new(options::NUMBER_FORMAT) @@ -713,7 +713,7 @@ let mut empty_line_count: u64 = 0; // Initially, we use the body's line counting settings let mut regex_filter = match settings.body_numbering { - NumberingStyle::NumberForRegularExpression(ref re) => re, + NumberingStyle::Regex(ref re) => re, _ => &regexp, }; let mut line_filter: fn(&str, &regex::Regex) -> bool = pass_regex; @@ -774,16 +774,16 @@ // a catch-all here. _ => &settings.body_numbering, } { - NumberingStyle::NumberForAll => { + NumberingStyle::All => { line_filter = pass_all; } - NumberingStyle::NumberForNonEmpty => { + NumberingStyle::NonEmpty => { line_filter = pass_nonempty; } - NumberingStyle::NumberForNone => { + NumberingStyle::None => { line_filter = pass_none; } - NumberingStyle::NumberForRegularExpression(ref re) => { + NumberingStyle::Regex(ref re) => { line_filter = pass_regex; regex_filter = re; } diff --git a/dev/uu_nl/fn.uu_app.html b/dev/uu_nl/fn.uu_app.html index f81779f84..9fee35e42 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

Function uu_nl::uu_app

source ·
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_nl - Rust

Function uu_nl::uu_app

source ·
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_nl/fn.uumain.html b/dev/uu_nl/fn.uumain.html index 1b7213918..69af69fe9 100644 --- a/dev/uu_nl/fn.uumain.html +++ b/dev/uu_nl/fn.uumain.html @@ -1 +1 @@ -uumain in uu_nl - Rust

Function uu_nl::uumain

source ·
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_nl - Rust

Function uu_nl::uumain

source ·
pub fn uumain(args: impl Args) -> i32
\ 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 6bcbd9b26..01bb09423 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 b9b96f321..e9dec717d 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

Constant uu_nl::options::FILE

source ·
pub const FILE: &str = "file";
\ No newline at end of file +FILE in uu_nl::options - Rust

Constant uu_nl::options::FILE

source ·
pub const FILE: &str = "file";
\ 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 0509384b5..006eaf159 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
pub const FOOTER_NUMBERING: &str = "footer-numbering";
\ No newline at end of file +FOOTER_NUMBERING in uu_nl::options - Rust
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 fd42e852f..8a90cd8f6 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
pub const HEADER_NUMBERING: &str = "header-numbering";
\ No newline at end of file +HEADER_NUMBERING in uu_nl::options - Rust
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 cdd9ed11f..ffcb95261 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

Constant uu_nl::options::HELP

source ·
pub const HELP: &str = "help";
\ No newline at end of file +HELP in uu_nl::options - Rust

Constant uu_nl::options::HELP

source ·
pub const HELP: &str = "help";
\ 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 6da910ed2..7de9105ab 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
pub const JOIN_BLANK_LINES: &str = "join-blank-lines";
\ No newline at end of file +JOIN_BLANK_LINES in uu_nl::options - Rust
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 f1ef4528e..965fa664d 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 f3ea2d3ca..f221c3149 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 2816789aa..6fb60300a 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 5ae66fe38..e1a40c613 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
pub const NUMBER_SEPARATOR: &str = "number-separator";
\ No newline at end of file +NUMBER_SEPARATOR in uu_nl::options - Rust
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 121a36bf5..207a18634 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 4cc736c98..1acfc5933 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
pub const SECTION_DELIMITER: &str = "section-delimiter";
\ No newline at end of file +SECTION_DELIMITER in uu_nl::options - Rust
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 f330439dc..921903162 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
pub const STARTING_LINE_NUMBER: &str = "starting-line-number";
\ No newline at end of file +STARTING_LINE_NUMBER in uu_nl::options - Rust
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 caebad413..f6513b87c 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