Add more consistency in the --help output and declarations

This commit is contained in:
Sylvestre Ledru 2022-08-04 21:34:16 +02:00
parent e1991525af
commit d957a11f34
27 changed files with 58 additions and 52 deletions

View file

@ -13,6 +13,7 @@ use uucore::{encoding::Format, error::UResult};
pub mod base_common; pub mod base_common;
static ABOUT: &str = "\ static ABOUT: &str = "\
encode/decode data and print to standard output
With no FILE, or when FILE is -, read standard input. With no FILE, or when FILE is -, read standard input.
The data are encoded as described for the base32 alphabet in RFC The data are encoded as described for the base32 alphabet in RFC

View file

@ -14,6 +14,7 @@ use uucore::{encoding::Format, error::UResult};
use std::io::{stdin, Read}; use std::io::{stdin, Read};
static ABOUT: &str = "\ static ABOUT: &str = "\
encode/decode data and print to standard output
With no FILE, or when FILE is -, read standard input. With no FILE, or when FILE is -, read standard input.
The data are encoded as described for the base64 alphabet in RFC The data are encoded as described for the base64 alphabet in RFC

View file

@ -13,8 +13,8 @@ use uucore::display::Quotable;
use uucore::error::{UResult, UUsageError}; use uucore::error::{UResult, UUsageError};
use uucore::{format_usage, InvalidEncodingHandling}; use uucore::{format_usage, InvalidEncodingHandling};
static SUMMARY: &str = "Print NAME with any leading directory components removed static ABOUT: &str = r#"Print NAME with any leading directory components removed
If specified, also remove a trailing SUFFIX"; If specified, also remove a trailing SUFFIX"#;
const USAGE: &str = "{} NAME [SUFFIX] const USAGE: &str = "{} NAME [SUFFIX]
{} OPTION... NAME..."; {} OPTION... NAME...";
@ -107,7 +107,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -21,6 +21,7 @@ use std::io::{stdin, Read};
use uucore::error::UClapError; use uucore::error::UClapError;
static ABOUT: &str = "\ static ABOUT: &str = "\
encode/decode data and print to standard output
With no FILE, or when FILE is -, read standard input. With no FILE, or when FILE is -, read standard input.
When decoding, the input may contain newlines in addition to the bytes of When decoding, the input may contain newlines in addition to the bytes of

View file

@ -40,8 +40,8 @@ use uucore::{format_usage, InvalidEncodingHandling};
static NAME: &str = "cat"; static NAME: &str = "cat";
static USAGE: &str = "{} [OPTION]... [FILE]..."; static USAGE: &str = "{} [OPTION]... [FILE]...";
static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output static ABOUT: &str = "Concatenate FILE(s), or standard input, to standard output
With no FILE, or when FILE is -, read standard input."; With no FILE, or when FILE is -, read standard input.";
#[derive(Error, Debug)] #[derive(Error, Debug)]
enum CatError { enum CatError {
@ -244,7 +244,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)

View file

@ -21,7 +21,7 @@ const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table();
const NAME: &str = "cksum"; const NAME: &str = "cksum";
const USAGE: &str = "{} [OPTIONS] [FILE]..."; 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] { const fn generate_crc_table() -> [u32; CRC_TABLE_LEN] {
let mut table = [0; 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()) Command::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -25,7 +25,7 @@ mod split_name;
use crate::csplit_error::CsplitError; use crate::csplit_error::CsplitError;
use crate::split_name::SplitName; 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."; 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..."; 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> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -27,7 +27,7 @@ mod searcher;
static NAME: &str = "cut"; static NAME: &str = "cut";
static USAGE: &str = static USAGE: &str =
"{} [-d] [-s] [-z] [--output-delimiter] ((-f|-b|-c) {{sequence}}) {{sourcefile}}+"; "{} [-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"; "Prints specified byte or field columns from each line of stdin or the input files";
static LONG_HELP: &str = " static LONG_HELP: &str = "
Each call must specify a mode (what to use for columns), Each call must specify a mode (what to use for columns),
@ -539,7 +539,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(ABOUT)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -26,7 +26,7 @@ mod options {
} }
static USAGE: &str = "{} [OPTION]... [FILE]"; 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 = " static LONG_HELP: &str = "
If FILE is specified, read it to determine which colors to use for which If FILE is specified, read it to determine which colors to use for which
file types and extensions. Otherwise, a precompiled database is used. 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> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(ABOUT)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)

View file

@ -78,7 +78,7 @@ mod options {
pub const FILE: &str = "FILE"; pub const FILE: &str = "FILE";
} }
const SUMMARY: &str = "estimate file space usage"; const ABOUT: &str = "estimate file space usage";
const LONG_HELP: &str = " const LONG_HELP: &str = "
Display values are in units of the first available SIZE from --block-size, Display values are in units of the first available SIZE from --block-size,
and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. 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<Option<u
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(ABOUT)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)

View file

@ -14,7 +14,7 @@ use uucore::error::{FromIo, UResult};
use uucore::{format_usage, InvalidEncodingHandling}; use uucore::{format_usage, InvalidEncodingHandling};
const NAME: &str = "echo"; 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 USAGE: &str = "{} [OPTIONS]... [STRING]...";
const AFTER_HELP: &str = r#" const AFTER_HELP: &str = r#"
Echo the STRING(s) to standard output. Echo the STRING(s) to standard output.
@ -136,7 +136,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.allow_hyphen_values(true) .allow_hyphen_values(true)
.infer_long_args(true) .infer_long_args(true)
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(ABOUT)
.after_help(AFTER_HELP) .after_help(AFTER_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.arg( .arg(

View file

@ -31,6 +31,7 @@ use uucore::format_usage;
#[cfg(unix)] #[cfg(unix)]
use uucore::signals::signal_name_by_value; 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 USAGE: &str = "{} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]";
const AFTER_HELP: &str = "\ const AFTER_HELP: &str = "\
A mere - implies -i. If no COMMAND, print the resulting environment. 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> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(crate_name!()) Command::new(crate_name!())
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .about(ABOUT)
.about(crate_description!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.after_help(AFTER_HELP) .after_help(AFTER_HELP)
.allow_external_subcommands(true) .allow_external_subcommands(true)

View file

@ -14,15 +14,13 @@ mod tokens;
const VERSION: &str = "version"; const VERSION: &str = "version";
const HELP: &str = "help"; const HELP: &str = "help";
static ABOUT: &str = "Print the value of EXPRESSION to standard output"; static USAGE: &str = r#"Print the value of EXPRESSION to standard output
static USAGE: &str = r#"
expr [EXPRESSION] expr [EXPRESSION]
expr [OPTIONS]"#; expr [OPTIONS]"#;
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT)
.override_usage(USAGE) .override_usage(USAGE)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -25,8 +25,8 @@ pub mod numeric;
mod rho; mod rho;
pub mod table; pub mod table;
static SUMMARY: &str = "Print the prime factors of the given NUMBER(s). static ABOUT: &str = r#"Print the prime factors of the given NUMBER(s).
If none are specified, read from standard input."; If none are specified, read from standard input."#;
mod options { mod options {
pub static NUMBER: &str = "NUMBER"; pub static NUMBER: &str = "NUMBER";
@ -81,7 +81,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg(Arg::new(options::NUMBER).multiple_occurrences(true)) .arg(Arg::new(options::NUMBER).multiple_occurrences(true))
} }

View file

@ -19,7 +19,7 @@ const TAB_WIDTH: usize = 8;
static NAME: &str = "fold"; static NAME: &str = "fold";
static USAGE: &str = "{} [OPTION]... [FILE]..."; 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"; to standard output whilst breaking long lines";
mod options { mod options {
@ -68,7 +68,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BYTES) Arg::new(options::BYTES)

View file

@ -12,7 +12,7 @@ use libc::c_long;
use uucore::{error::UResult, format_usage}; use uucore::{error::UResult, format_usage};
const USAGE: &str = "{} [options]"; 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 // currently rust libc interface doesn't include gethostid
extern "C" { extern "C" {
@ -29,7 +29,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)
} }

View file

@ -33,7 +33,7 @@ fn get_userlogin() -> Option<String> {
} }
} }
static SUMMARY: &str = "Print user's login name"; static ABOUT: &str = "Print user's login name";
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -55,6 +55,6 @@ pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.override_usage(uucore::execution_phrase()) .override_usage(uucore::execution_phrase())
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
} }

View file

@ -53,6 +53,9 @@ static CONTEXT_HELP_TEXT: &str = "print any security context of each file (not e
#[cfg(feature = "selinux")] #[cfg(feature = "selinux")]
static CONTEXT_HELP_TEXT: &str = "print any security context of each file"; 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]..."; const USAGE: &str = "{} [OPTION]... [FILE]...";
pub mod options { pub mod options {
@ -898,7 +901,7 @@ pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about("List directory contents. Ignore files and directories starting with a '.' by default") .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::HELP) Arg::new(options::HELP)

View file

@ -17,7 +17,7 @@ use uucore::{display::Quotable, InvalidEncodingHandling};
static NAME: &str = "mkfifo"; static NAME: &str = "mkfifo";
static USAGE: &str = "{} [OPTION]... NAME..."; 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 { mod options {
pub static MODE: &str = "mode"; pub static MODE: &str = "mode";
@ -75,7 +75,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::MODE) Arg::new(options::MODE)

View file

@ -19,6 +19,7 @@ use uucore::{format_usage, InvalidEncodingHandling};
mod helper; mod helper;
static NAME: &str = "nl"; static NAME: &str = "nl";
static ABOUT: &str = "number lines of files";
static USAGE: &str = "{} [OPTION]... [FILE]..."; static USAGE: &str = "{} [OPTION]... [FILE]...";
// Settings store options used by nl to produce its output. // 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> { pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.name(NAME) .name(NAME)
.about(ABOUT)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)

View file

@ -22,7 +22,7 @@ use clap::{crate_version, Arg, Command};
use std::path::PathBuf; use std::path::PathBuf;
use uucore::{format_usage, InvalidEncodingHandling}; use uucore::{format_usage, InvalidEncodingHandling};
static ABOUT: &str = "pinky - lightweight finger"; static ABOUT: &str = "lightweight finger";
const USAGE: &str = "{} [OPTION]... [USER]..."; const USAGE: &str = "{} [OPTION]... [USER]...";
mod options { mod options {

View file

@ -20,8 +20,8 @@ use uucore::{format_usage, InvalidEncodingHandling};
static NAME: &str = "sum"; static NAME: &str = "sum";
static USAGE: &str = "{} [OPTION]... [FILE]..."; static USAGE: &str = "{} [OPTION]... [FILE]...";
static SUMMARY: &str = "Checksum and count the blocks in a file.\n\ static ABOUT: &str = r#"Checksum and count the blocks in a file.
With no FILE, or when FILE is -, read standard input."; With no FILE, or when FILE is -, read standard input."#;
// This can be replaced with usize::div_ceil once it is stabilized. // This can be replaced with usize::div_ceil once it is stabilized.
// This implementation approach is optimized for when `b` is a constant, // This implementation approach is optimized for when `b` is a constant,
@ -156,7 +156,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)

View file

@ -26,7 +26,7 @@ use crate::error::TacError;
static NAME: &str = "tac"; static NAME: &str = "tac";
static USAGE: &str = "{} [OPTION]... [FILE]..."; 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 { mod options {
pub static BEFORE: &str = "before"; pub static BEFORE: &str = "before";
@ -65,7 +65,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BEFORE) Arg::new(options::BEFORE)

View file

@ -14,10 +14,10 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UResult, USimpleError}; use uucore::error::{FromIo, UResult, USimpleError};
use uucore::{format_usage, InvalidEncodingHandling}; 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). 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."; If FILE is not passed in, stdin is used instead.";
static USAGE: &str = "tsort [OPTIONS] FILE"; static USAGE: &str = "{} [OPTIONS] FILE";
mod options { mod options {
pub const FILE: &str = "file"; pub const FILE: &str = "file";
@ -93,7 +93,7 @@ pub fn uu_app<'a>() -> Command<'a> {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)

View file

@ -17,7 +17,8 @@ use uucore::{
format_usage, 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]..."; const USAGE: &str = "{} [OPTION]...";
pub mod options { pub mod options {

View file

@ -25,8 +25,8 @@ use uucore::{format_usage, InvalidEncodingHandling};
static NAME: &str = "unexpand"; static NAME: &str = "unexpand";
static USAGE: &str = "{} [OPTION]... [FILE]..."; static USAGE: &str = "{} [OPTION]... [FILE]...";
static SUMMARY: &str = "Convert blanks in each FILE to tabs, writing to standard output.\n\ 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."; With no FILE, or when FILE is -, read standard input."#;
const DEFAULT_TABSTOP: usize = 8; const DEFAULT_TABSTOP: usize = 8;
@ -179,7 +179,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(ABOUT)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)

View file

@ -10,9 +10,6 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::io::{self, Result, Write}; use std::io::{self, Result, Write};
#[macro_use]
extern crate clap;
use clap::{Arg, Command}; use clap::{Arg, Command};
use uucore::error::{UResult, USimpleError}; use uucore::error::{UResult, USimpleError};
use uucore::format_usage; use uucore::format_usage;
@ -20,6 +17,7 @@ use uucore::format_usage;
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
mod splice; mod splice;
const ABOUT: &str = "repeatedly display a line with STRING (or 'y')";
const USAGE: &str = "{} [STRING]..."; const USAGE: &str = "{} [STRING]...";
// it's possible that using a smaller or larger buffer might provide better performance on some // 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> { pub fn uu_app<'a>() -> Command<'a> {
command!() Command::new(uucore::util_name())
.about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.arg(Arg::new("STRING").index(1).multiple_occurrences(true)) .arg(Arg::new("STRING").index(1).multiple_occurrences(true))
.infer_long_args(true) .infer_long_args(true)