diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index 4260c472e..ce246af08 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -13,6 +13,7 @@ use uucore::{encoding::Format, error::UResult}; pub mod base_common; static ABOUT: &str = "\ +encode/decode data and print to standard output With no FILE, or when FILE is -, read standard input. The data are encoded as described for the base32 alphabet in RFC diff --git a/src/uu/base64/src/base64.rs b/src/uu/base64/src/base64.rs index 1bfe29312..760142bb2 100644 --- a/src/uu/base64/src/base64.rs +++ b/src/uu/base64/src/base64.rs @@ -14,6 +14,7 @@ use uucore::{encoding::Format, error::UResult}; use std::io::{stdin, Read}; static ABOUT: &str = "\ +encode/decode data and print to standard output With no FILE, or when FILE is -, read standard input. The data are encoded as described for the base64 alphabet in RFC diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index b425e2034..770fc34cf 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -13,8 +13,8 @@ use uucore::display::Quotable; use uucore::error::{UResult, UUsageError}; use uucore::{format_usage, InvalidEncodingHandling}; -static SUMMARY: &str = "Print NAME with any leading directory components removed -If specified, also remove a trailing SUFFIX"; +static ABOUT: &str = r#"Print NAME with any leading directory components removed +If specified, also remove a trailing SUFFIX"#; const USAGE: &str = "{} NAME [SUFFIX] {} OPTION... NAME..."; @@ -107,7 +107,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) - .about(SUMMARY) + .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) .arg( diff --git a/src/uu/basenc/src/basenc.rs b/src/uu/basenc/src/basenc.rs index d8dfd28ca..1ecacf936 100644 --- a/src/uu/basenc/src/basenc.rs +++ b/src/uu/basenc/src/basenc.rs @@ -21,6 +21,7 @@ use std::io::{stdin, Read}; use uucore::error::UClapError; static ABOUT: &str = "\ +encode/decode data and print to standard output With no FILE, or when FILE is -, read standard input. When decoding, the input may contain newlines in addition to the bytes of diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 34f6f2d54..77f75b858 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -40,8 +40,8 @@ use uucore::{format_usage, InvalidEncodingHandling}; static NAME: &str = "cat"; static USAGE: &str = "{} [OPTION]... [FILE]..."; -static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output - With no FILE, or when FILE is -, read standard input."; +static ABOUT: &str = "Concatenate FILE(s), or standard input, to standard output +With no FILE, or when FILE is -, read standard input."; #[derive(Error, Debug)] enum CatError { @@ -244,7 +244,7 @@ pub fn uu_app<'a>() -> Command<'a> { .name(NAME) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) .arg( Arg::new(options::FILE) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index e9a5c5620..3cc8100ad 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -21,7 +21,7 @@ const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table(); const NAME: &str = "cksum"; const USAGE: &str = "{} [OPTIONS] [FILE]..."; -const SUMMARY: &str = "Print CRC and size for each file"; +const ABOUT: &str = "Print CRC and size for each file"; const fn generate_crc_table() -> [u32; CRC_TABLE_LEN] { let mut table = [0; CRC_TABLE_LEN]; @@ -144,7 +144,7 @@ pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .name(NAME) .version(crate_version!()) - .about(SUMMARY) + .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) .arg( diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 50b01921e..998b6fcd1 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -25,7 +25,7 @@ mod split_name; use crate::csplit_error::CsplitError; use crate::split_name::SplitName; -static SUMMARY: &str = "split a file into sections determined by context lines"; +static ABOUT: &str = "split a file into sections determined by context lines"; static LONG_HELP: &str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output."; const USAGE: &str = "{} [OPTION]... FILE PATTERN..."; @@ -749,7 +749,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) - .about(SUMMARY) + .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) .arg( diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 2a9a7d942..b4a125555 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -27,7 +27,7 @@ mod searcher; static NAME: &str = "cut"; static USAGE: &str = "{} [-d] [-s] [-z] [--output-delimiter] ((-f|-b|-c) {{sequence}}) {{sourcefile}}+"; -static SUMMARY: &str = +static ABOUT: &str = "Prints specified byte or field columns from each line of stdin or the input files"; static LONG_HELP: &str = " Each call must specify a mode (what to use for columns), @@ -539,7 +539,7 @@ pub fn uu_app<'a>() -> Command<'a> { .name(NAME) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about(SUMMARY) + .about(ABOUT) .after_help(LONG_HELP) .infer_long_args(true) .arg( diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index f84690599..6d9ec8626 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -26,7 +26,7 @@ mod options { } static USAGE: &str = "{} [OPTION]... [FILE]"; -static SUMMARY: &str = "Output commands to set the LS_COLORS environment variable."; +static ABOUT: &str = "Output commands to set the LS_COLORS environment variable."; static LONG_HELP: &str = " If FILE is specified, read it to determine which colors to use for which file types and extensions. Otherwise, a precompiled database is used. @@ -173,7 +173,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) - .about(SUMMARY) + .about(ABOUT) .after_help(LONG_HELP) .override_usage(format_usage(USAGE)) .infer_long_args(true) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index d52536c5c..c8f7b9307 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -78,7 +78,7 @@ mod options { pub const FILE: &str = "FILE"; } -const SUMMARY: &str = "estimate file space usage"; +const ABOUT: &str = "estimate file space usage"; const LONG_HELP: &str = " Display values are in units of the first available SIZE from --block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. @@ -729,7 +729,7 @@ fn parse_depth(max_depth_str: Option<&str>, summarize: bool) -> UResult() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) - .about(SUMMARY) + .about(ABOUT) .after_help(LONG_HELP) .override_usage(format_usage(USAGE)) .infer_long_args(true) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 2f8b2af4e..89580b7a6 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -14,7 +14,7 @@ use uucore::error::{FromIo, UResult}; use uucore::{format_usage, InvalidEncodingHandling}; const NAME: &str = "echo"; -const SUMMARY: &str = "display a line of text"; +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. @@ -136,7 +136,7 @@ pub fn uu_app<'a>() -> Command<'a> { .allow_hyphen_values(true) .infer_long_args(true) .version(crate_version!()) - .about(SUMMARY) + .about(ABOUT) .after_help(AFTER_HELP) .override_usage(format_usage(USAGE)) .arg( diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 7fa036656..74c02cad1 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -31,6 +31,7 @@ use uucore::format_usage; #[cfg(unix)] use uucore::signals::signal_name_by_value; +const ABOUT: &str = "set each NAME to VALUE in the environment and run COMMAND"; const USAGE: &str = "{} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]"; const AFTER_HELP: &str = "\ A mere - implies -i. If no COMMAND, print the resulting environment. @@ -128,8 +129,7 @@ fn build_command<'a, 'b>(args: &'a mut Vec<&'b str>) -> (Cow<'b, str>, &'a [&'b pub fn uu_app<'a>() -> Command<'a> { Command::new(crate_name!()) .version(crate_version!()) - .author(crate_authors!()) - .about(crate_description!()) + .about(ABOUT) .override_usage(format_usage(USAGE)) .after_help(AFTER_HELP) .allow_external_subcommands(true) diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index f202b091c..104398241 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -14,15 +14,13 @@ mod tokens; const VERSION: &str = "version"; const HELP: &str = "help"; -static ABOUT: &str = "Print the value of EXPRESSION to standard output"; -static USAGE: &str = r#" +static USAGE: &str = r#"Print the value of EXPRESSION to standard output expr [EXPRESSION] expr [OPTIONS]"#; pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) - .about(ABOUT) .override_usage(USAGE) .infer_long_args(true) .arg( diff --git a/src/uu/factor/src/cli.rs b/src/uu/factor/src/cli.rs index ff248dd47..2410876d6 100644 --- a/src/uu/factor/src/cli.rs +++ b/src/uu/factor/src/cli.rs @@ -25,8 +25,8 @@ pub mod numeric; mod rho; pub mod table; -static SUMMARY: &str = "Print the prime factors of the given NUMBER(s). -If none are specified, read from standard input."; +static ABOUT: &str = r#"Print the prime factors of the given NUMBER(s). +If none are specified, read from standard input."#; mod options { pub static NUMBER: &str = "NUMBER"; @@ -81,7 +81,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) .arg(Arg::new(options::NUMBER).multiple_occurrences(true)) } diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 285ac7fb3..720bcc92c 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -19,7 +19,7 @@ const TAB_WIDTH: usize = 8; static NAME: &str = "fold"; static USAGE: &str = "{} [OPTION]... [FILE]..."; -static SUMMARY: &str = "Writes each file (or standard input if no files are given) +static ABOUT: &str = "Writes each file (or standard input if no files are given) to standard output whilst breaking long lines"; mod options { @@ -68,7 +68,7 @@ pub fn uu_app<'a>() -> Command<'a> { .name(NAME) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) .arg( Arg::new(options::BYTES) diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index b60446e9f..d555a068f 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -12,7 +12,7 @@ use libc::c_long; use uucore::{error::UResult, format_usage}; const USAGE: &str = "{} [options]"; -const SUMMARY: &str = "Print the numeric identifier (in hexadecimal) for the current host"; +const ABOUT: &str = "Print the numeric identifier (in hexadecimal) for the current host"; // currently rust libc interface doesn't include gethostid extern "C" { @@ -29,7 +29,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) - .about(SUMMARY) + .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) } diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index 31246b5c7..29a74a373 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -33,7 +33,7 @@ fn get_userlogin() -> Option { } } -static SUMMARY: &str = "Print user's login name"; +static ABOUT: &str = "Print user's login name"; #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { @@ -55,6 +55,6 @@ pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) .override_usage(uucore::execution_phrase()) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) } diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 9811a16ec..27faa7673 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -53,6 +53,9 @@ static CONTEXT_HELP_TEXT: &str = "print any security context of each file (not e #[cfg(feature = "selinux")] static CONTEXT_HELP_TEXT: &str = "print any security context of each file"; +const ABOUT: &str = r#"List directory contents. +Ignore files and directories starting with a '.' by default"#; + const USAGE: &str = "{} [OPTION]... [FILE]..."; pub mod options { @@ -898,7 +901,7 @@ pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about("List directory contents. Ignore files and directories starting with a '.' by default") + .about(ABOUT) .infer_long_args(true) .arg( Arg::new(options::HELP) diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index 9198c352f..236cfccc4 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -17,7 +17,7 @@ use uucore::{display::Quotable, InvalidEncodingHandling}; static NAME: &str = "mkfifo"; static USAGE: &str = "{} [OPTION]... NAME..."; -static SUMMARY: &str = "Create a FIFO with the given name."; +static ABOUT: &str = "Create a FIFO with the given name."; mod options { pub static MODE: &str = "mode"; @@ -75,7 +75,7 @@ pub fn uu_app<'a>() -> Command<'a> { .name(NAME) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) .arg( Arg::new(options::MODE) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index e6ca7f931..4f340869c 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -19,6 +19,7 @@ use uucore::{format_usage, InvalidEncodingHandling}; mod helper; static NAME: &str = "nl"; +static ABOUT: &str = "number lines of files"; static USAGE: &str = "{} [OPTION]... [FILE]..."; // Settings store options used by nl to produce its output. @@ -143,6 +144,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .name(NAME) + .about(ABOUT) .version(crate_version!()) .override_usage(format_usage(USAGE)) .infer_long_args(true) diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index c8153d590..ab5339281 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -22,7 +22,7 @@ use clap::{crate_version, Arg, Command}; use std::path::PathBuf; use uucore::{format_usage, InvalidEncodingHandling}; -static ABOUT: &str = "pinky - lightweight finger"; +static ABOUT: &str = "lightweight finger"; const USAGE: &str = "{} [OPTION]... [USER]..."; mod options { diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 7e3716e3f..3c197c029 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -20,8 +20,8 @@ use uucore::{format_usage, InvalidEncodingHandling}; static NAME: &str = "sum"; static USAGE: &str = "{} [OPTION]... [FILE]..."; -static SUMMARY: &str = "Checksum and count the blocks in a file.\n\ - With no FILE, or when FILE is -, read standard input."; +static ABOUT: &str = r#"Checksum and count the blocks in a file. + With no FILE, or when FILE is -, read standard input."#; // This can be replaced with usize::div_ceil once it is stabilized. // This implementation approach is optimized for when `b` is a constant, @@ -156,7 +156,7 @@ pub fn uu_app<'a>() -> Command<'a> { .name(NAME) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) .arg( Arg::new(options::FILE) diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index e2992197d..07f0ffe15 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -26,7 +26,7 @@ use crate::error::TacError; static NAME: &str = "tac"; static USAGE: &str = "{} [OPTION]... [FILE]..."; -static SUMMARY: &str = "Write each file to standard output, last line first."; +static ABOUT: &str = "Write each file to standard output, last line first."; mod options { pub static BEFORE: &str = "before"; @@ -65,7 +65,7 @@ pub fn uu_app<'a>() -> Command<'a> { .name(NAME) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) .arg( Arg::new(options::BEFORE) diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index ead4d4451..056c2be8d 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -14,10 +14,10 @@ use uucore::display::Quotable; use uucore::error::{FromIo, UResult, USimpleError}; use uucore::{format_usage, InvalidEncodingHandling}; -static SUMMARY: &str = "Topological sort the strings in FILE. +static ABOUT: &str = "Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). If FILE is not passed in, stdin is used instead."; -static USAGE: &str = "tsort [OPTIONS] FILE"; +static USAGE: &str = "{} [OPTIONS] FILE"; mod options { pub const FILE: &str = "file"; @@ -93,7 +93,7 @@ pub fn uu_app<'a>() -> Command<'a> { Command::new(uucore::util_name()) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) .arg( Arg::new(options::FILE) diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index daf4a5d58..cd74ee094 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -17,7 +17,8 @@ use uucore::{ format_usage, }; -const ABOUT: &str = "Print certain system information. With no OPTION, same as -s."; +const ABOUT: &str = r#"Print certain system information. +With no OPTION, same as -s."#; const USAGE: &str = "{} [OPTION]..."; pub mod options { diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 9ffb56af7..341ef340e 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -25,8 +25,8 @@ use uucore::{format_usage, InvalidEncodingHandling}; static NAME: &str = "unexpand"; static USAGE: &str = "{} [OPTION]... [FILE]..."; -static SUMMARY: &str = "Convert blanks in each FILE to tabs, writing to standard output.\n\ - With no FILE, or when FILE is -, read standard input."; +static ABOUT: &str = r#"Convert blanks in each FILE to tabs, writing to standard output. + With no FILE, or when FILE is -, read standard input."#; const DEFAULT_TABSTOP: usize = 8; @@ -179,7 +179,7 @@ pub fn uu_app<'a>() -> Command<'a> { .name(NAME) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .about(SUMMARY) + .about(ABOUT) .infer_long_args(true) .arg( Arg::new(options::FILE) diff --git a/src/uu/yes/src/yes.rs b/src/uu/yes/src/yes.rs index f78ddbfb6..7b88b26a4 100644 --- a/src/uu/yes/src/yes.rs +++ b/src/uu/yes/src/yes.rs @@ -10,9 +10,6 @@ use std::borrow::Cow; use std::io::{self, Result, Write}; -#[macro_use] -extern crate clap; - use clap::{Arg, Command}; use uucore::error::{UResult, USimpleError}; use uucore::format_usage; @@ -20,6 +17,7 @@ use uucore::format_usage; #[cfg(any(target_os = "linux", target_os = "android"))] mod splice; +const ABOUT: &str = "repeatedly display a line with STRING (or 'y')"; const USAGE: &str = "{} [STRING]..."; // it's possible that using a smaller or larger buffer might provide better performance on some @@ -50,7 +48,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } pub fn uu_app<'a>() -> Command<'a> { - command!() + Command::new(uucore::util_name()) + .about(ABOUT) .override_usage(format_usage(USAGE)) .arg(Arg::new("STRING").index(1).multiple_occurrences(true)) .infer_long_args(true)