From 98dd31c00d5a7e5be5991b8fdd8437ce8c395543 Mon Sep 17 00:00:00 2001 From: m11o Date: Tue, 25 Apr 2023 22:00:22 +0900 Subject: [PATCH 1/3] split: move help strings to markdown file --- src/uu/split/split.md | 11 +++++++++++ src/uu/split/src/split.rs | 12 +++++------- 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 src/uu/split/split.md diff --git a/src/uu/split/split.md b/src/uu/split/split.md new file mode 100644 index 000000000..d43b77159 --- /dev/null +++ b/src/uu/split/split.md @@ -0,0 +1,11 @@ +# split + +``` +split [OPTION]... [INPUT [PREFIX]] +``` + +Create output files containing consecutive or interleaved sections of input + +## After Help + +Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is -, read standard input. diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index d737c8513..f09a6517f 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -23,7 +23,7 @@ use std::io::{stdin, BufRead, BufReader, BufWriter, ErrorKind, Read, Write}; use std::path::Path; use uucore::display::Quotable; use uucore::error::{FromIo, UIoError, UResult, USimpleError, UUsageError}; -use uucore::format_usage; +use uucore::{format_usage, help_about, help_usage, help_section}; use uucore::parse_size::{parse_size, ParseSizeError}; use uucore::uio_error; @@ -47,11 +47,9 @@ static OPT_ELIDE_EMPTY_FILES: &str = "elide-empty-files"; static ARG_INPUT: &str = "input"; static ARG_PREFIX: &str = "prefix"; -const USAGE: &str = "{} [OPTION]... [INPUT [PREFIX]]"; -const AFTER_HELP: &str = "\ - Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default \ - size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is \ - -, read standard input."; +const ABOUT: &str = help_about!("split.md"); +const USAGE: &str = help_usage!("split.md"); +const AFTER_HELP: &str = help_section!("after help", "split.md"); #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { @@ -66,7 +64,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app() -> Command { Command::new(uucore::util_name()) .version(crate_version!()) - .about("Create output files containing consecutive or interleaved sections of input") + .about(ABOUT) .after_help(AFTER_HELP) .override_usage(format_usage(USAGE)) .infer_long_args(true) From 869614d343cde2d4c8a3aa03f63e56a2954ea520 Mon Sep 17 00:00:00 2001 From: m11o Date: Tue, 25 Apr 2023 22:01:10 +0900 Subject: [PATCH 2/3] fix cargo fmt --- src/uu/split/src/split.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index f09a6517f..2bf62e39e 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -23,9 +23,9 @@ use std::io::{stdin, BufRead, BufReader, BufWriter, ErrorKind, Read, Write}; use std::path::Path; use uucore::display::Quotable; use uucore::error::{FromIo, UIoError, UResult, USimpleError, UUsageError}; -use uucore::{format_usage, help_about, help_usage, help_section}; use uucore::parse_size::{parse_size, ParseSizeError}; use uucore::uio_error; +use uucore::{format_usage, help_about, help_section, help_usage}; static OPT_BYTES: &str = "bytes"; static OPT_LINE_BYTES: &str = "line-bytes"; From 0b84aa52f327b4290296ef63724bfc868e30417e Mon Sep 17 00:00:00 2001 From: m11o Date: Tue, 25 Apr 2023 22:26:47 +0900 Subject: [PATCH 3/3] fix check-spell --- src/uu/split/split.md | 2 ++ src/uu/split/src/split.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uu/split/split.md b/src/uu/split/split.md index d43b77159..d3a481fd3 100644 --- a/src/uu/split/split.md +++ b/src/uu/split/split.md @@ -1,3 +1,5 @@ + + # split ``` diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 2bf62e39e..6e29e6f4b 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -5,7 +5,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// spell-checker:ignore (ToDO) PREFIXaa PREFIXab nbbbb ncccc +// spell-checker:ignore nbbbb ncccc mod filenames; mod number;