From a795eb5d22abfb74a6dc81055df6d7ba7e599b9b Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Sun, 15 Jun 2025 12:19:16 +0300 Subject: [PATCH 01/15] Improve error reporting of script arguments Specify the argument number rather than its initial string, as the latter can be ambiguous. --- src/uu/sed/src/script_line_provider.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/uu/sed/src/script_line_provider.rs b/src/uu/sed/src/script_line_provider.rs index d75eb9b9..24525f92 100644 --- a/src/uu/sed/src/script_line_provider.rs +++ b/src/uu/sed/src/script_line_provider.rs @@ -104,22 +104,13 @@ impl ScriptLineProvider { return Ok(()); } - fn truncate_with_ellipsis(input: &str) -> String { - const MAX_LEN: usize = 20; - if input.chars().count() <= MAX_LEN { - input.to_string() - } else { - input.chars().take(MAX_LEN).collect::() + "..." - } - } - match &self.sources[next_index] { ScriptValue::StringVal(s) => { let cursor = std::io::Cursor::new(s.clone()); self.state = State::Active { index: next_index, reader: Box::new(BufReader::new(cursor)), - input_name: truncate_with_ellipsis(s), + input_name: format!("