From 1c90daf25a504cd63e1a154d8ba6aa57d6609c4b Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Tue, 21 Mar 2023 13:51:20 +0800 Subject: [PATCH] head: move help strings to markdown file --- src/uu/head/head.md | 11 +++++++++++ src/uu/head/src/head.rs | 12 +++--------- 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 src/uu/head/head.md diff --git a/src/uu/head/head.md b/src/uu/head/head.md new file mode 100644 index 000000000..476f3affc --- /dev/null +++ b/src/uu/head/head.md @@ -0,0 +1,11 @@ +# head + +``` +head [FLAG]... [FILE]... +``` + +Print the first 10 lines of each `FILE` to standard output. +With more than one `FILE`, precede each with a header giving the file name. +With no `FILE`, or when `FILE` is `-`, read standard input. + +Mandatory arguments to long flags are mandatory for short flags too. diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 48debc81f..b9ac5024b 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -11,21 +11,15 @@ use std::io::{self, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write}; use uucore::display::Quotable; use uucore::error::{FromIo, UError, UResult, USimpleError}; use uucore::lines::lines; -use uucore::{format_usage, show}; +use uucore::{format_usage, help_about, help_usage, show}; const BUF_SIZE: usize = 65536; /// The capacity in bytes for buffered writers. const BUFWRITER_CAPACITY: usize = 16_384; // 16 kilobytes -const ABOUT: &str = "\ - Print the first 10 lines of each FILE to standard output.\n\ - With more than one FILE, precede each with a header giving the file name.\n\ - With no FILE, or when FILE is -, read standard input.\n\ - \n\ - Mandatory arguments to long flags are mandatory for short flags too.\ - "; -const USAGE: &str = "{} [FLAG]... [FILE]..."; +const ABOUT: &str = help_about!("head.md"); +const USAGE: &str = help_usage!("head.md"); mod options { pub const BYTES_NAME: &str = "BYTES";