From c90c8ea214f988e8ce5c16a401917c7b8c81185d Mon Sep 17 00:00:00 2001 From: IZUMI-Zu <274620705z@gmail.com> Date: Tue, 7 Mar 2023 10:25:42 +0800 Subject: [PATCH] echo: move help strings to markdown file --- src/uu/echo/echo.md | 26 ++++++++++++++++++++++++++ src/uu/echo/src/echo.rs | 25 ++++--------------------- 2 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 src/uu/echo/echo.md diff --git a/src/uu/echo/echo.md b/src/uu/echo/echo.md new file mode 100644 index 000000000..4330ecd88 --- /dev/null +++ b/src/uu/echo/echo.md @@ -0,0 +1,26 @@ +# echo + +``` +echo [OPTIONS]... [STRING]... +``` + +Display a line of text + +## After Help + +Echo the STRING(s) to standard output. + +If -e is in effect, the following sequences are recognized: + +\\ backslash +\a alert (BEL) +\b backspace +\c produce no further output +\e escape +\f form feed +\n new line +\r carriage return +\t horizontal tab +\v vertical tab +\0NNN byte with octal value NNN (1 to 3 digits) +\xHH byte with hexadecimal value HH (1 to 2 digits) \ No newline at end of file diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 6c6959aff..659dc836c 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -11,28 +11,11 @@ use std::io::{self, Write}; use std::iter::Peekable; use std::str::Chars; use uucore::error::{FromIo, UResult}; -use uucore::format_usage; +use uucore::{format_usage, help_about, help_section, help_usage}; -const ABOUT: &str = "Display a line of text"; -const USAGE: &str = "{} [OPTIONS]... [STRING]..."; -const AFTER_HELP: &str = r#" - Echo the STRING(s) to standard output. - - If -e is in effect, the following sequences are recognized: - - \\\\ backslash - \\a alert (BEL) - \\b backspace - \\c produce no further output - \\e escape - \\f form feed - \\n new line - \\r carriage return - \\t horizontal tab - \\v vertical tab - \\0NNN byte with octal value NNN (1 to 3 digits) - \\xHH byte with hexadecimal value HH (1 to 2 digits) -"#; +const ABOUT: &str = help_about!("echo.md"); +const USAGE: &str = help_usage!("echo.md"); +const AFTER_HELP: &str = help_section!("after help", "echo.md"); mod options { pub const STRING: &str = "STRING";