1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

l10n: adjust the code to use help_about & help_usage

This commit is contained in:
Sylvestre Ledru 2025-05-31 08:52:01 +02:00
parent 42cfb3d8be
commit d8bb7875cf
98 changed files with 362 additions and 478 deletions

View file

@ -5,24 +5,25 @@
pub mod base_common; pub mod base_common;
use base_common::ReadSeek;
use clap::Command; use clap::Command;
use uucore::{encoding::Format, error::UResult, help_about, help_usage}; use uucore::{encoding::Format, error::UResult, locale::get_message};
const ABOUT: &str = help_about!("base32.md");
const USAGE: &str = help_usage!("base32.md");
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let format = Format::Base32; let format = Format::Base32;
let (about, usage) = get_info();
let config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?; let config = base_common::parse_base_cmd_args(args, about, usage)?;
let mut input = base_common::get_input(&config)?;
let mut input: Box<dyn ReadSeek> = base_common::get_input(&config)?;
base_common::handle_input(&mut input, format, config) base_common::handle_input(&mut input, format, config)
} }
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
base_common::base_app(ABOUT, USAGE) let (about, usage) = get_info();
base_common::base_app(about, usage)
}
fn get_info() -> (&'static str, &'static str) {
let about: &'static str = Box::leak(get_message("base32-about").into_boxed_str());
let usage: &'static str = Box::leak(get_message("base32-usage").into_boxed_str());
(about, usage)
} }

View file

@ -5,22 +5,24 @@
use clap::Command; use clap::Command;
use uu_base32::base_common; use uu_base32::base_common;
use uucore::{encoding::Format, error::UResult, help_about, help_usage}; use uucore::{encoding::Format, error::UResult, locale::get_message};
const ABOUT: &str = help_about!("base64.md");
const USAGE: &str = help_usage!("base64.md");
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let format = Format::Base64; let format = Format::Base64;
let (about, usage) = get_info();
let config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?; let config = base_common::parse_base_cmd_args(args, about, usage)?;
let mut input = base_common::get_input(&config)?; let mut input = base_common::get_input(&config)?;
base_common::handle_input(&mut input, format, config) base_common::handle_input(&mut input, format, config)
} }
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
base_common::base_app(ABOUT, USAGE) let (about, usage) = get_info();
base_common::base_app(about, usage)
}
fn get_info() -> (&'static str, &'static str) {
let about: &'static str = Box::leak(get_message("base64-about").into_boxed_str());
let usage: &'static str = Box::leak(get_message("base64-usage").into_boxed_str());
(about, usage)
} }

View file

@ -12,9 +12,7 @@ use uucore::error::{UResult, UUsageError};
use uucore::line_ending::LineEnding; use uucore::line_ending::LineEnding;
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
static ABOUT: &str = help_about!("basename.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("basename.md");
pub mod options { pub mod options {
pub static MULTIPLE: &str = "multiple"; pub static MULTIPLE: &str = "multiple";
@ -77,8 +75,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("basename-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("basename-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::MULTIPLE) Arg::new(options::MULTIPLE)

View file

@ -8,15 +8,11 @@
use clap::{Arg, ArgAction, Command}; use clap::{Arg, ArgAction, Command};
use uu_base32::base_common::{self, BASE_CMD_PARSE_ERROR, Config}; use uu_base32::base_common::{self, BASE_CMD_PARSE_ERROR, Config};
use uucore::error::UClapError; use uucore::error::UClapError;
use uucore::locale::get_message;
use uucore::{ use uucore::{
encoding::Format, encoding::Format,
error::{UResult, UUsageError}, error::{UResult, UUsageError},
}; };
use uucore::{help_about, help_usage};
const ABOUT: &str = help_about!("basenc.md");
const USAGE: &str = help_usage!("basenc.md");
const ENCODINGS: &[(&str, Format, &str)] = &[ const ENCODINGS: &[(&str, Format, &str)] = &[
("base64", Format::Base64, "same as 'base64' program"), ("base64", Format::Base64, "same as 'base64' program"),
("base64url", Format::Base64Url, "file- and url-safe base64"), ("base64url", Format::Base64Url, "file- and url-safe base64"),
@ -47,7 +43,10 @@ const ENCODINGS: &[(&str, Format, &str)] = &[
]; ];
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
let mut command = base_common::base_app(ABOUT, USAGE); let about: &'static str = Box::leak(get_message("basenc-about").into_boxed_str());
let usage: &'static str = Box::leak(get_message("basenc-usage").into_boxed_str());
let mut command = base_common::base_app(about, usage);
for encoding in ENCODINGS { for encoding in ENCODINGS {
let raw_arg = Arg::new(encoding.0) let raw_arg = Arg::new(encoding.0)
.long(encoding.0) .long(encoding.0)

View file

@ -30,8 +30,7 @@ use uucore::{fast_inc::fast_inc_one, format_usage, help_about, help_usage};
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
mod splice; mod splice;
const USAGE: &str = help_usage!("cat.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("cat.md");
// Allocate 32 digits for the line number. // Allocate 32 digits for the line number.
// An estimate is that we can print about 1e8 lines/seconds, so 32 digits // An estimate is that we can print about 1e8 lines/seconds, so 32 digits
@ -275,8 +274,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("cat-usage")))
.about(ABOUT) .about(get_message("cat-about"))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(

View file

@ -24,8 +24,7 @@ mod fts;
use errors::*; use errors::*;
const ABOUT: &str = help_about!("chcon.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("chcon.md");
pub mod options { pub mod options {
pub static HELP: &str = "help"; pub static HELP: &str = "help";
@ -151,8 +150,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("chcon-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("chcon-usage")))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.args_override_self(true) .args_override_self(true)

View file

@ -16,8 +16,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command};
use std::fs; use std::fs;
use std::os::unix::fs::MetadataExt; use std::os::unix::fs::MetadataExt;
const ABOUT: &str = help_about!("chgrp.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("chgrp.md");
fn parse_gid_from_str(group: &str) -> Result<u32, String> { fn parse_gid_from_str(group: &str) -> Result<u32, String> {
if let Some(gid_str) = group.strip_prefix(':') { if let Some(gid_str) = group.strip_prefix(':') {
@ -99,8 +98,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("chgrp-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("chgrp-usage")))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.arg( .arg(

View file

@ -19,8 +19,7 @@ use uucore::mode;
use uucore::perms::{TraverseSymlinks, configure_symlink_and_recursion}; use uucore::perms::{TraverseSymlinks, configure_symlink_and_recursion};
use uucore::{format_usage, help_about, help_section, help_usage, show, show_error}; use uucore::{format_usage, help_about, help_section, help_usage, show, show_error};
const ABOUT: &str = help_about!("chmod.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("chmod.md");
const LONG_USAGE: &str = help_section!("after help", "chmod.md"); const LONG_USAGE: &str = help_section!("after help", "chmod.md");
mod options { mod options {
@ -159,8 +158,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("chmod-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("chmod-usage")))
.args_override_self(true) .args_override_self(true)
.infer_long_args(true) .infer_long_args(true)
.no_binary_name(true) .no_binary_name(true)

View file

@ -17,9 +17,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command};
use std::fs; use std::fs;
use std::os::unix::fs::MetadataExt; use std::os::unix::fs::MetadataExt;
static ABOUT: &str = help_about!("chown.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("chown.md");
fn parse_gid_uid_and_filter(matches: &ArgMatches) -> UResult<GidUidOwnerFilter> { fn parse_gid_uid_and_filter(matches: &ArgMatches) -> UResult<GidUidOwnerFilter> {
let filter = if let Some(spec) = matches.get_one::<String>(options::FROM) { let filter = if let Some(spec) = matches.get_one::<String>(options::FROM) {
@ -79,8 +77,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("chown-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("chown-usage")))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.arg( .arg(

View file

@ -19,7 +19,7 @@ use uucore::fs::{MissingHandling, ResolveMode, canonicalize};
use uucore::libc::{self, chroot, setgid, setgroups, setuid}; use uucore::libc::{self, chroot, setgid, setgroups, setuid};
use uucore::{format_usage, help_about, help_usage, show}; use uucore::{format_usage, help_about, help_usage, show};
static ABOUT: &str = help_about!("chroot.md"); use uucore::locale::{self, get_message};
static USAGE: &str = help_usage!("chroot.md"); static USAGE: &str = help_usage!("chroot.md");
mod options { mod options {
@ -237,8 +237,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("chroot-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("chroot-usage")))
.infer_long_args(true) .infer_long_args(true)
.trailing_var_arg(true) .trailing_var_arg(true)
.arg( .arg(

View file

@ -26,9 +26,7 @@ use uucore::{
sum::Digest, sum::Digest,
}; };
const USAGE: &str = help_usage!("cksum.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("cksum.md");
const AFTER_HELP: &str = help_section!("after help", "cksum.md");
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
enum OutputFormat { enum OutputFormat {
@ -343,8 +341,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("cksum-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("cksum-usage")))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(
@ -468,7 +466,7 @@ pub fn uu_app() -> Command {
) )
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.after_help(AFTER_HELP) .after_help(get_message("cksum-after-help"))
} }
#[cfg(test)] #[cfg(test)]

View file

@ -15,8 +15,7 @@ use uucore::{format_usage, help_about, help_usage};
use clap::{Arg, ArgAction, ArgMatches, Command}; use clap::{Arg, ArgAction, ArgMatches, Command};
const ABOUT: &str = help_about!("comm.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("comm.md");
mod options { mod options {
pub const COLUMN_1: &str = "1"; pub const COLUMN_1: &str = "1";
@ -314,8 +313,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("comm-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("comm-usage")))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(

View file

@ -451,9 +451,7 @@ fn show_debug(copy_debug: &CopyDebug) {
); );
} }
const ABOUT: &str = help_about!("cp.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("cp.md");
const AFTER_HELP: &str = help_section!("after help", "cp.md");
static EXIT_ERR: i32 = 1; static EXIT_ERR: i32 = 1;
@ -523,10 +521,11 @@ pub fn uu_app() -> Command {
]; ];
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("cp-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("cp-usage")))
.after_help(format!( .after_help(format!(
"{AFTER_HELP}\n\n{}", "{}\n\n{}",
get_message("cp-after-help"),
backup_control::BACKUP_CONTROL_LONG_HELP backup_control::BACKUP_CONTROL_LONG_HELP
)) ))
.infer_long_args(true) .infer_long_args(true)

View file

@ -25,9 +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;
const ABOUT: &str = help_about!("csplit.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "csplit.md");
const USAGE: &str = help_usage!("csplit.md");
mod options { mod options {
pub const SUFFIX_FORMAT: &str = "suffix-format"; pub const SUFFIX_FORMAT: &str = "suffix-format";
@ -631,8 +629,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("csplit-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("csplit-usage")))
.args_override_self(true) .args_override_self(true)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
@ -697,7 +695,7 @@ pub fn uu_app() -> Command {
.action(ArgAction::Append) .action(ArgAction::Append)
.required(true), .required(true),
) )
.after_help(AFTER_HELP) .after_help(get_message("csplit-after-help"))
} }
#[cfg(test)] #[cfg(test)]

View file

@ -24,9 +24,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error, sho
mod matcher; mod matcher;
mod searcher; mod searcher;
const USAGE: &str = help_usage!("cut.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("cut.md");
const AFTER_HELP: &str = help_section!("after help", "cut.md");
struct Options<'a> { struct Options<'a> {
out_delimiter: Option<&'a [u8]>, out_delimiter: Option<&'a [u8]>,
@ -580,9 +578,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("cut-usage")))
.about(ABOUT) .about(get_message("cut-about"))
.after_help(AFTER_HELP) .after_help(get_message("cut-after-help"))
.infer_long_args(true) .infer_long_args(true)
// While `args_override_self(true)` for some arguments, such as `-d` // While `args_override_self(true)` for some arguments, such as `-d`
// and `--output-delimiter`, is consistent to the behavior of GNU cut, // and `--output-delimiter`, is consistent to the behavior of GNU cut,

View file

@ -30,8 +30,7 @@ const MINUTES: &str = "minutes";
const SECONDS: &str = "seconds"; const SECONDS: &str = "seconds";
const NS: &str = "ns"; const NS: &str = "ns";
const ABOUT: &str = help_about!("date.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("date.md");
const OPT_DATE: &str = "date"; const OPT_DATE: &str = "date";
const OPT_FORMAT: &str = "format"; const OPT_FORMAT: &str = "format";
@ -290,8 +289,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("date-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("date-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_DATE) Arg::new(OPT_DATE)

View file

@ -62,9 +62,7 @@ use uucore::error::{USimpleError, set_exit_code};
use uucore::show_if_err; use uucore::show_if_err;
use uucore::{format_usage, help_about, help_section, help_usage, show_error}; use uucore::{format_usage, help_about, help_section, help_usage, show_error};
const ABOUT: &str = help_about!("dd.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "dd.md");
const USAGE: &str = help_usage!("dd.md");
const BUF_INIT_BYTE: u8 = 0xDD; const BUF_INIT_BYTE: u8 = 0xDD;
/// Final settings after parsing /// Final settings after parsing
@ -1427,9 +1425,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("dd-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("dd-usage")))
.after_help(AFTER_HELP) .after_help(get_message("dd-after-help"))
.infer_long_args(true) .infer_long_args(true)
.arg(Arg::new(options::OPERANDS).num_args(1..)) .arg(Arg::new(options::OPERANDS).num_args(1..))
} }

View file

@ -29,9 +29,7 @@ use crate::filesystem::Filesystem;
use crate::filesystem::FsError; use crate::filesystem::FsError;
use crate::table::Table; use crate::table::Table;
const ABOUT: &str = help_about!("df.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("df.md");
const AFTER_HELP: &str = help_section!("after help", "df.md");
static OPT_HELP: &str = "help"; static OPT_HELP: &str = "help";
static OPT_ALL: &str = "all"; static OPT_ALL: &str = "all";
@ -452,9 +450,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("df-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("df-usage")))
.after_help(AFTER_HELP) .after_help(get_message("df-after-help"))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.arg( .arg(

View file

@ -26,9 +26,7 @@ mod options {
pub const FILE: &str = "FILE"; pub const FILE: &str = "FILE";
} }
const USAGE: &str = help_usage!("dircolors.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("dircolors.md");
const AFTER_HELP: &str = help_section!("after help", "dircolors.md");
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
pub enum OutputFmt { pub enum OutputFmt {
@ -245,9 +243,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("dircolors-about"))
.after_help(AFTER_HELP) .after_help(get_message("dircolors-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("dircolors-usage")))
.args_override_self(true) .args_override_self(true)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -10,9 +10,7 @@ use uucore::error::{UResult, UUsageError};
use uucore::line_ending::LineEnding; use uucore::line_ending::LineEnding;
use uucore::{format_usage, help_about, help_section, help_usage}; use uucore::{format_usage, help_about, help_section, help_usage};
const ABOUT: &str = help_about!("dirname.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("dirname.md");
const AFTER_HELP: &str = help_section!("after help", "dirname.md");
mod options { mod options {
pub const ZERO: &str = "zero"; pub const ZERO: &str = "zero";
@ -21,7 +19,9 @@ mod options {
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?; let matches = uu_app()
.after_help(get_message("dirname-after-help"))
.try_get_matches_from(args)?;
let line_ending = LineEnding::from_zero_flag(matches.get_flag(options::ZERO)); let line_ending = LineEnding::from_zero_flag(matches.get_flag(options::ZERO));
@ -61,9 +61,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.about(ABOUT) .about(get_message("dirname-about"))
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("dirname-usage")))
.args_override_self(true) .args_override_self(true)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -70,9 +70,7 @@ mod options {
pub const FILE: &str = "FILE"; pub const FILE: &str = "FILE";
} }
const ABOUT: &str = help_about!("du.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "du.md");
const USAGE: &str = help_usage!("du.md");
struct TraversalOptions { struct TraversalOptions {
all: bool, all: bool,
@ -824,9 +822,9 @@ fn parse_depth(max_depth_str: Option<&str>, summarize: bool) -> UResult<Option<u
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("du-about"))
.after_help(AFTER_HELP) .after_help(get_message("du-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("du-usage")))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.arg( .arg(

View file

@ -12,9 +12,7 @@ use uucore::error::{UResult, USimpleError};
use uucore::format::{FormatChar, OctalParsing, parse_escape_only}; use uucore::format::{FormatChar, OctalParsing, parse_escape_only};
use uucore::{format_usage, help_about, help_section, help_usage}; use uucore::{format_usage, help_about, help_section, help_usage};
const ABOUT: &str = help_about!("echo.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("echo.md");
const AFTER_HELP: &str = help_section!("after help", "echo.md");
mod options { mod options {
pub const STRING: &str = "STRING"; pub const STRING: &str = "STRING";
@ -141,9 +139,9 @@ pub fn uu_app() -> Command {
.trailing_var_arg(true) .trailing_var_arg(true)
.allow_hyphen_values(true) .allow_hyphen_values(true)
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("echo-about"))
.after_help(AFTER_HELP) .after_help(get_message("echo-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("echo-usage")))
.arg( .arg(
Arg::new(options::NO_NEWLINE) Arg::new(options::NO_NEWLINE)
.short('n') .short('n')

10
src/uu/env/src/env.rs vendored
View file

@ -74,9 +74,7 @@ impl From<string_parser::Error> for EnvError {
} }
} }
const ABOUT: &str = help_about!("env.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("env.md");
const AFTER_HELP: &str = help_section!("after help", "env.md");
mod options { mod options {
pub const IGNORE_ENVIRONMENT: &str = "ignore-environment"; pub const IGNORE_ENVIRONMENT: &str = "ignore-environment";
@ -222,9 +220,9 @@ fn load_config_file(opts: &mut Options) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(crate_name!()) Command::new(crate_name!())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("env-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("env-usage")))
.after_help(AFTER_HELP) .after_help(get_message("env-after-help"))
.infer_long_args(true) .infer_long_args(true)
.trailing_var_arg(true) .trailing_var_arg(true)
.arg( .arg(

View file

@ -18,8 +18,7 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UError, UResult, set_exit_code}; use uucore::error::{FromIo, UError, UResult, set_exit_code};
use uucore::{format_usage, help_about, help_usage, show_error}; use uucore::{format_usage, help_about, help_usage, show_error};
const ABOUT: &str = help_about!("expand.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("expand.md");
pub mod options { pub mod options {
pub static TABS: &str = "tabs"; pub static TABS: &str = "tabs";
@ -253,9 +252,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("expand-about"))
.after_help(LONG_HELP) .after_help(LONG_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("expand-usage")))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(

View file

@ -16,8 +16,7 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UResult, USimpleError, set_exit_code}; use uucore::error::{FromIo, UResult, USimpleError, set_exit_code};
use uucore::{format_usage, help_about, help_usage, show_error, show_warning}; use uucore::{format_usage, help_about, help_usage, show_error, show_warning};
const ABOUT: &str = help_about!("factor.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("factor.md");
mod options { mod options {
pub static EXPONENTS: &str = "exponents"; pub static EXPONENTS: &str = "exponents";
@ -122,8 +121,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("factor-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("factor-usage")))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.args_override_self(true) .args_override_self(true)

View file

@ -7,7 +7,7 @@ use std::{ffi::OsString, io::Write};
use uucore::error::{UResult, set_exit_code}; use uucore::error::{UResult, set_exit_code};
use uucore::help_about; use uucore::help_about;
const ABOUT: &str = help_about!("false.md"); use uucore::locale::{self, get_message};
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -46,7 +46,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("false-about"))
// We provide our own help and version options, to ensure maximum compatibility with GNU. // We provide our own help and version options, to ensure maximum compatibility with GNU.
.disable_help_flag(true) .disable_help_flag(true)
.disable_version_flag(true) .disable_version_flag(true)

View file

@ -18,8 +18,7 @@ use parasplit::ParagraphStream;
mod linebreak; mod linebreak;
mod parasplit; mod parasplit;
const ABOUT: &str = help_about!("fmt.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("fmt.md");
const MAX_WIDTH: usize = 2500; const MAX_WIDTH: usize = 2500;
const DEFAULT_GOAL: usize = 70; const DEFAULT_GOAL: usize = 70;
const DEFAULT_WIDTH: usize = 75; const DEFAULT_WIDTH: usize = 75;
@ -336,8 +335,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("fmt-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("fmt-usage")))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(

View file

@ -15,8 +15,7 @@ use uucore::{format_usage, help_about, help_usage};
const TAB_WIDTH: usize = 8; const TAB_WIDTH: usize = 8;
const USAGE: &str = help_usage!("fold.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("fold.md");
mod options { mod options {
pub const BYTES: &str = "bytes"; pub const BYTES: &str = "bytes";
@ -60,8 +59,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("fold-usage")))
.about(ABOUT) .about(get_message("fold-about"))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BYTES) Arg::new(options::BYTES)

View file

@ -18,8 +18,7 @@ use clap::{Arg, ArgAction, Command};
mod options { mod options {
pub const USERS: &str = "USERNAME"; pub const USERS: &str = "USERNAME";
} }
const ABOUT: &str = help_about!("groups.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("groups.md");
#[derive(Debug, Error)] #[derive(Debug, Error)]
enum GroupsError { enum GroupsError {
@ -82,8 +81,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("groups-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("groups-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::USERS) Arg::new(options::USERS)

View file

@ -30,8 +30,7 @@ use uucore::sum::{Digest, Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shak
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const NAME: &str = "hashsum"; const NAME: &str = "hashsum";
const ABOUT: &str = help_about!("hashsum.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("hashsum.md");
struct Options { struct Options {
algoname: &'static str, algoname: &'static str,
@ -318,8 +317,8 @@ pub fn uu_app_common() -> Command {
const TEXT_HELP: &str = "read in text mode (default)"; const TEXT_HELP: &str = "read in text mode (default)";
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("hashsum-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("hashsum-usage")))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(

View file

@ -20,8 +20,7 @@ use uucore::{format_usage, help_about, help_usage, show};
const BUF_SIZE: usize = 65536; const BUF_SIZE: usize = 65536;
const ABOUT: &str = help_about!("head.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("head.md");
mod options { mod options {
pub const BYTES_NAME: &str = "BYTES"; pub const BYTES_NAME: &str = "BYTES";
@ -72,8 +71,8 @@ type HeadResult<T> = Result<T, HeadError>;
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("head-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("head-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BYTES_NAME) Arg::new(options::BYTES_NAME)

View file

@ -9,8 +9,7 @@ use clap::Command;
use libc::{c_long, gethostid}; use libc::{c_long, gethostid};
use uucore::{error::UResult, format_usage, help_about, help_usage}; use uucore::{error::UResult, format_usage, help_about, help_usage};
const USAGE: &str = help_usage!("hostid.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("hostid.md");
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -22,8 +21,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("hostid-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("hostid-usage")))
.infer_long_args(true) .infer_long_args(true)
} }

View file

@ -21,8 +21,7 @@ use uucore::{
format_usage, help_about, help_usage, format_usage, help_about, help_usage,
}; };
const ABOUT: &str = help_about!("hostname.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("hostname.md");
static OPT_DOMAIN: &str = "domain"; static OPT_DOMAIN: &str = "domain";
static OPT_IP_ADDRESS: &str = "ip-address"; static OPT_IP_ADDRESS: &str = "ip-address";
@ -76,8 +75,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("hostname-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("hostname-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_DOMAIN) Arg::new(OPT_DOMAIN)

View file

@ -59,9 +59,7 @@ macro_rules! cstr2cow {
}; };
} }
const ABOUT: &str = help_about!("id.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("id.md");
const AFTER_HELP: &str = help_section!("after help", "id.md");
#[cfg(not(feature = "selinux"))] #[cfg(not(feature = "selinux"))]
static CONTEXT_HELP_TEXT: &str = "print only the security context of the process (not enabled)"; static CONTEXT_HELP_TEXT: &str = "print only the security context of the process (not enabled)";
@ -119,7 +117,9 @@ struct State {
#[uucore::main] #[uucore::main]
#[allow(clippy::cognitive_complexity)] #[allow(clippy::cognitive_complexity)]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?; let matches = uu_app()
.after_help(get_message("id-after-help"))
.try_get_matches_from(args)?;
let users: Vec<String> = matches let users: Vec<String> = matches
.get_many::<String>(options::ARG_USERS) .get_many::<String>(options::ARG_USERS)
@ -327,8 +327,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("id-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("id-usage")))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(

View file

@ -140,8 +140,7 @@ impl Behavior {
} }
} }
const ABOUT: &str = help_about!("install.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("install.md");
static OPT_COMPARE: &str = "compare"; static OPT_COMPARE: &str = "compare";
static OPT_DIRECTORY: &str = "directory"; static OPT_DIRECTORY: &str = "directory";
@ -185,8 +184,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("install-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("install-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg(backup_control::arguments::backup()) .arg(backup_control::arguments::backup())
.arg(backup_control::arguments::backup_no_args()) .arg(backup_control::arguments::backup_no_args())
@ -516,7 +515,11 @@ fn standard(mut paths: Vec<String>, b: &Behavior) -> UResult<()> {
return Err(UUsageError::new(1, "missing file operand")); return Err(UUsageError::new(1, "missing file operand"));
} }
if b.no_target_dir && paths.len() > 2 { if b.no_target_dir && paths.len() > 2 {
return Err(InstallError::ExtraOperand(paths[2].clone(), format_usage(USAGE)).into()); return Err(InstallError::ExtraOperand(
paths[2].clone(),
format_usage(&get_message("install-usage")),
)
.into());
} }
// get the target from either "-t foo" param or from the last given paths argument // get the target from either "-t foo" param or from the last given paths argument

View file

@ -21,8 +21,7 @@ use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code};
use uucore::line_ending::LineEnding; use uucore::line_ending::LineEnding;
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("join.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("join.md");
#[derive(Debug, Error)] #[derive(Debug, Error)]
enum JoinError { enum JoinError {
@ -855,8 +854,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("join-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("join-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new("a") Arg::new("a")

View file

@ -14,8 +14,7 @@ use uucore::error::{FromIo, UResult, USimpleError};
use uucore::signals::{ALL_SIGNALS, signal_by_name_or_value, signal_name_by_value}; use uucore::signals::{ALL_SIGNALS, signal_by_name_or_value, signal_name_by_value};
use uucore::{format_usage, help_about, help_usage, show}; use uucore::{format_usage, help_about, help_usage, show};
static ABOUT: &str = help_about!("kill.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("kill.md");
// When the -l option is selected, the program displays the type of signal related to a certain // When the -l option is selected, the program displays the type of signal related to a certain
// value or string. In case of a value, the program should control the lower 8 bits, but there is // value or string. In case of a value, the program should control the lower 8 bits, but there is
@ -104,8 +103,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("kill-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("kill-usage")))
.infer_long_args(true) .infer_long_args(true)
.allow_negative_numbers(true) .allow_negative_numbers(true)
.arg( .arg(

View file

@ -11,8 +11,7 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UResult}; use uucore::error::{FromIo, UResult};
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
static ABOUT: &str = help_about!("link.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("link.md");
pub mod options { pub mod options {
pub static FILES: &str = "FILES"; pub static FILES: &str = "FILES";
@ -36,8 +35,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("link-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("link-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILES) Arg::new(options::FILES)

View file

@ -70,9 +70,7 @@ impl UError for LnError {
} }
} }
const ABOUT: &str = help_about!("ln.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("ln.md");
const AFTER_HELP: &str = help_section!("after help", "ln.md");
mod options { mod options {
pub const FORCE: &str = "force"; pub const FORCE: &str = "force";
@ -93,7 +91,8 @@ static ARG_FILES: &str = "files";
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let after_help = format!( let after_help = format!(
"{AFTER_HELP}\n\n{}", "{}\n\n{}",
get_message("ln-after-help"),
backup_control::BACKUP_CONTROL_LONG_HELP backup_control::BACKUP_CONTROL_LONG_HELP
); );
@ -144,8 +143,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("ln-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("ln-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg(backup_control::arguments::backup()) .arg(backup_control::arguments::backup())
.arg(backup_control::arguments::backup_no_args()) .arg(backup_control::arguments::backup_no_args())

View file

@ -25,8 +25,7 @@ fn get_userlogin() -> Option<String> {
} }
} }
const ABOUT: &str = help_about!("logname.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("logname.md");
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -43,7 +42,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(uucore::util_name())
.about(ABOUT) .about(get_message("logname-about"))
.infer_long_args(true) .infer_long_args(true)
} }

View file

@ -82,9 +82,7 @@ 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 = help_about!("ls.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "ls.md");
const USAGE: &str = help_usage!("ls.md");
pub mod options { pub mod options {
pub mod format { pub mod format {
@ -1179,8 +1177,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("ls-usage")))
.about(ABOUT) .about(get_message("ls-about"))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.args_override_self(true) .args_override_self(true)
@ -1869,7 +1867,7 @@ pub fn uu_app() -> Command {
.value_hint(clap::ValueHint::AnyPath) .value_hint(clap::ValueHint::AnyPath)
.value_parser(ValueParser::os_string()), .value_parser(ValueParser::os_string()),
) )
.after_help(AFTER_HELP) .after_help(get_message("ls-after-help"))
} }
/// Represents a Path along with it's associated data. /// Represents a Path along with it's associated data.

View file

@ -20,9 +20,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_if_err};
static DEFAULT_PERM: u32 = 0o777; static DEFAULT_PERM: u32 = 0o777;
const ABOUT: &str = help_about!("mkdir.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("mkdir.md");
const AFTER_HELP: &str = help_section!("after help", "mkdir.md");
mod options { mod options {
pub const MODE: &str = "mode"; pub const MODE: &str = "mode";
@ -103,7 +101,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// Linux-specific options, not implemented // Linux-specific options, not implemented
// opts.optflag("Z", "context", "set SELinux security context" + // opts.optflag("Z", "context", "set SELinux security context" +
// " of each created directory to CTX"), // " of each created directory to CTX"),
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?; let matches = uu_app()
.after_help(get_message("mkdir-after-help"))
.try_get_matches_from(args)?;
let dirs = matches let dirs = matches
.get_many::<OsString>(options::DIRS) .get_many::<OsString>(options::DIRS)
@ -133,8 +133,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("mkdir-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("mkdir-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::MODE) Arg::new(options::MODE)

View file

@ -13,7 +13,7 @@ use uucore::error::{UResult, USimpleError};
use uucore::{format_usage, help_about, help_usage, show}; use uucore::{format_usage, help_about, help_usage, show};
static USAGE: &str = help_usage!("mkfifo.md"); static USAGE: &str = help_usage!("mkfifo.md");
static ABOUT: &str = help_about!("mkfifo.md"); use uucore::locale::{self, get_message};
mod options { mod options {
pub static MODE: &str = "mode"; pub static MODE: &str = "mode";
@ -86,8 +86,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("mkfifo-usage")))
.about(ABOUT) .about(get_message("mkfifo-about"))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::MODE) Arg::new(options::MODE)

View file

@ -14,9 +14,7 @@ use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError, UUsageError, set_exit_code}; use uucore::error::{UResult, USimpleError, UUsageError, set_exit_code};
use uucore::{format_usage, help_about, help_section, help_usage}; use uucore::{format_usage, help_about, help_section, help_usage};
const ABOUT: &str = help_about!("mknod.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("mknod.md");
const AFTER_HELP: &str = help_section!("after help", "mknod.md");
const MODE_RW_UGO: mode_t = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; const MODE_RW_UGO: mode_t = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
@ -159,9 +157,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("mknod-usage")))
.after_help(AFTER_HELP) .after_help(get_message("mknod-after-help"))
.about(ABOUT) .about(get_message("mknod-about"))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::MODE) Arg::new(options::MODE)

View file

@ -25,8 +25,7 @@ use rand::Rng;
use tempfile::Builder; use tempfile::Builder;
use thiserror::Error; use thiserror::Error;
const ABOUT: &str = help_about!("mktemp.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("mktemp.md");
static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX"; static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX";
@ -347,8 +346,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("mktemp-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("mktemp-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_DIRECTORY) Arg::new(OPT_DIRECTORY)

View file

@ -26,8 +26,7 @@ use uucore::error::{UResult, USimpleError, UUsageError};
use uucore::{display::Quotable, show}; use uucore::{display::Quotable, show};
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("more.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("more.md");
const BELL: char = '\x07'; // Printing this character will ring the bell const BELL: char = '\x07'; // Printing this character will ring the bell
// The prompt to be displayed at the top of the screen when viewing multiple files, // The prompt to be displayed at the top of the screen when viewing multiple files,
@ -155,8 +154,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.about(ABOUT) .about(get_message("more-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("more-usage")))
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -123,9 +123,7 @@ pub enum OverwriteMode {
Force, Force,
} }
const ABOUT: &str = help_about!("mv.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("mv.md");
const AFTER_HELP: &str = help_section!("after help", "mv.md");
static OPT_FORCE: &str = "force"; static OPT_FORCE: &str = "force";
static OPT_INTERACTIVE: &str = "interactive"; static OPT_INTERACTIVE: &str = "interactive";
@ -205,10 +203,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("mv-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("mv-usage")))
.after_help(format!( .after_help(format!(
"{AFTER_HELP}\n\n{}", "{}\n\n{}",
get_message("mv-after-help"),
backup_control::BACKUP_CONTROL_LONG_HELP backup_control::BACKUP_CONTROL_LONG_HELP
)) ))
.infer_long_args(true) .infer_long_args(true)

View file

@ -21,8 +21,7 @@ pub mod options {
pub static COMMAND: &str = "COMMAND"; pub static COMMAND: &str = "COMMAND";
} }
const ABOUT: &str = help_about!("nice.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("nice.md");
fn is_prefix_of(maybe_prefix: &str, target: &str, min_match: usize) -> bool { fn is_prefix_of(maybe_prefix: &str, target: &str, min_match: usize) -> bool {
if maybe_prefix.len() < min_match || maybe_prefix.len() > target.len() { if maybe_prefix.len() < min_match || maybe_prefix.len() > target.len() {
@ -186,8 +185,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.about(ABOUT) .about(get_message("nice-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("nice-usage")))
.trailing_var_arg(true) .trailing_var_arg(true)
.infer_long_args(true) .infer_long_args(true)
.version(uucore::crate_version!()) .version(uucore::crate_version!())

View file

@ -12,9 +12,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error};
mod helper; mod helper;
const ABOUT: &str = help_about!("nl.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "nl.md");
const USAGE: &str = help_usage!("nl.md");
// Settings store options used by nl to produce its output. // Settings store options used by nl to produce its output.
pub struct Settings { pub struct Settings {
@ -222,10 +220,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.about(ABOUT) .about(get_message("nl-about"))
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("nl-usage")))
.after_help(AFTER_HELP) .after_help(get_message("nl-after-help"))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.arg( .arg(

View file

@ -19,9 +19,7 @@ use uucore::display::Quotable;
use uucore::error::{UClapError, UError, UResult, set_exit_code}; use uucore::error::{UClapError, UError, UResult, set_exit_code};
use uucore::{format_usage, help_about, help_section, help_usage, show_error}; use uucore::{format_usage, help_about, help_section, help_usage, show_error};
const ABOUT: &str = help_about!("nohup.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "nohup.md");
const USAGE: &str = help_usage!("nohup.md");
static NOHUP_OUT: &str = "nohup.out"; static NOHUP_OUT: &str = "nohup.out";
// exit codes that match the GNU implementation // exit codes that match the GNU implementation
static EXIT_CANCELED: i32 = 125; static EXIT_CANCELED: i32 = 125;
@ -92,9 +90,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("nohup-about"))
.after_help(AFTER_HELP) .after_help(get_message("nohup-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("nohup-usage")))
.arg( .arg(
Arg::new(options::CMD) Arg::new(options::CMD)
.hide(true) .hide(true)

View file

@ -23,8 +23,7 @@ pub const _SC_NPROCESSORS_CONF: libc::c_int = 1001;
static OPT_ALL: &str = "all"; static OPT_ALL: &str = "all";
static OPT_IGNORE: &str = "ignore"; static OPT_IGNORE: &str = "ignore";
const ABOUT: &str = help_about!("nproc.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("nproc.md");
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -94,8 +93,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("nproc-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("nproc-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_ALL) Arg::new(OPT_ALL)

View file

@ -24,9 +24,7 @@ pub mod format;
pub mod options; pub mod options;
mod units; mod units;
const ABOUT: &str = help_about!("numfmt.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "numfmt.md");
const USAGE: &str = help_usage!("numfmt.md");
fn handle_args<'a>(args: impl Iterator<Item = &'a str>, options: &NumfmtOptions) -> UResult<()> { fn handle_args<'a>(args: impl Iterator<Item = &'a str>, options: &NumfmtOptions) -> UResult<()> {
for l in args { for l in args {
@ -277,9 +275,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("numfmt-about"))
.after_help(AFTER_HELP) .after_help(get_message("numfmt-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("numfmt-usage")))
.allow_negative_numbers(true) .allow_negative_numbers(true)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -50,9 +50,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error, sho
const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes
const ABOUT: &str = help_about!("od.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("od.md");
const AFTER_HELP: &str = help_section!("after help", "od.md");
pub(crate) mod options { pub(crate) mod options {
pub const HELP: &str = "help"; pub const HELP: &str = "help";
@ -253,9 +251,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("od-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("od-usage")))
.after_help(AFTER_HELP) .after_help(get_message("od-after-help"))
.trailing_var_arg(true) .trailing_var_arg(true)
.dont_delimit_trailing_values(true) .dont_delimit_trailing_values(true)
.infer_long_args(true) .infer_long_args(true)

View file

@ -14,8 +14,7 @@ use uucore::error::{UResult, USimpleError};
use uucore::line_ending::LineEnding; use uucore::line_ending::LineEnding;
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("paste.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("paste.md");
mod options { mod options {
pub const DELIMITER: &str = "delimiters"; pub const DELIMITER: &str = "delimiters";
@ -43,8 +42,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("paste-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("paste-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::SERIAL) Arg::new(options::SERIAL)

View file

@ -20,8 +20,7 @@ enum Mode {
Both, // a combination of `Basic` and `Extra` Both, // a combination of `Basic` and `Extra`
} }
const ABOUT: &str = help_about!("pathchk.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("pathchk.md");
mod options { mod options {
pub const POSIX: &str = "posix"; pub const POSIX: &str = "posix";
@ -80,8 +79,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("pathchk-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("pathchk-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::POSIX) Arg::new(options::POSIX)

View file

@ -20,9 +20,7 @@ const ABOUT: &str = concat!(
); );
#[cfg(not(target_env = "musl"))] #[cfg(not(target_env = "musl"))]
const ABOUT: &str = help_about!("pinky.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("pinky.md");
mod options { mod options {
pub const LONG_FORMAT: &str = "long_format"; pub const LONG_FORMAT: &str = "long_format";
@ -44,8 +42,8 @@ use platform::uumain;
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("pinky-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("pinky-usage")))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.arg( .arg(

View file

@ -20,9 +20,7 @@ use uucore::display::Quotable;
use uucore::error::UResult; use uucore::error::UResult;
use uucore::{format_usage, help_about, help_section, help_usage}; use uucore::{format_usage, help_about, help_section, help_usage};
const ABOUT: &str = help_about!("pr.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("pr.md");
const AFTER_HELP: &str = help_section!("after help", "pr.md");
const TAB: char = '\t'; const TAB: char = '\t';
const LINES_PER_PAGE: usize = 66; const LINES_PER_PAGE: usize = 66;
const LINES_PER_PAGE_FOR_FORM_FEED: usize = 63; const LINES_PER_PAGE_FOR_FORM_FEED: usize = 63;
@ -153,9 +151,9 @@ enum PrError {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("pr-about"))
.after_help(AFTER_HELP) .after_help(get_message("pr-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("pr-usage")))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.disable_help_flag(true) .disable_help_flag(true)

View file

@ -7,8 +7,7 @@ use clap::{Arg, ArgAction, Command};
use std::env; use std::env;
use uucore::{error::UResult, format_usage, help_about, help_usage}; use uucore::{error::UResult, format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("printenv.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("printenv.md");
static OPT_NULL: &str = "null"; static OPT_NULL: &str = "null";
@ -56,8 +55,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("printenv-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("printenv-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_NULL) Arg::new(OPT_NULL)

View file

@ -11,9 +11,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, os_str_as_bytes
const VERSION: &str = "version"; const VERSION: &str = "version";
const HELP: &str = "help"; const HELP: &str = "help";
const USAGE: &str = help_usage!("printf.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("printf.md");
const AFTER_HELP: &str = help_section!("after help", "printf.md");
mod options { mod options {
pub const FORMAT: &str = "FORMAT"; pub const FORMAT: &str = "FORMAT";
@ -81,9 +79,9 @@ pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.allow_hyphen_values(true) .allow_hyphen_values(true)
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("printf-about"))
.after_help(AFTER_HELP) .after_help(get_message("printf-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("printf-usage")))
.disable_help_flag(true) .disable_help_flag(true)
.disable_version_flag(true) .disable_version_flag(true)
.arg( .arg(

View file

@ -19,8 +19,7 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UError, UResult, UUsageError}; use uucore::error::{FromIo, UError, UResult, UUsageError};
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const USAGE: &str = help_usage!("ptx.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("ptx.md");
#[derive(Debug)] #[derive(Debug)]
enum OutFormat { enum OutFormat {
@ -765,9 +764,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.about(ABOUT) .about(get_message("ptx-about"))
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("ptx-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)

View file

@ -13,8 +13,7 @@ use uucore::{format_usage, help_about, help_usage};
use uucore::display::println_verbatim; use uucore::display::println_verbatim;
use uucore::error::{FromIo, UResult}; use uucore::error::{FromIo, UResult};
const ABOUT: &str = help_about!("pwd.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("pwd.md");
const OPT_LOGICAL: &str = "logical"; const OPT_LOGICAL: &str = "logical";
const OPT_PHYSICAL: &str = "physical"; const OPT_PHYSICAL: &str = "physical";
@ -141,8 +140,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("pwd-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("pwd-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_LOGICAL) Arg::new(OPT_LOGICAL)

View file

@ -15,8 +15,7 @@ use uucore::fs::{MissingHandling, ResolveMode, canonicalize};
use uucore::line_ending::LineEnding; use uucore::line_ending::LineEnding;
use uucore::{format_usage, help_about, help_usage, show_error}; use uucore::{format_usage, help_about, help_usage, show_error};
const ABOUT: &str = help_about!("readlink.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("readlink.md");
const OPT_CANONICALIZE: &str = "canonicalize"; const OPT_CANONICALIZE: &str = "canonicalize";
const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing"; const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing"; const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
@ -102,8 +101,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("readlink-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("readlink-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_CANONICALIZE) Arg::new(OPT_CANONICALIZE)

View file

@ -21,8 +21,7 @@ use uucore::{
show_if_err, show_if_err,
}; };
static ABOUT: &str = help_about!("realpath.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("realpath.md");
static OPT_QUIET: &str = "quiet"; static OPT_QUIET: &str = "quiet";
static OPT_STRIP: &str = "strip"; static OPT_STRIP: &str = "strip";
@ -89,8 +88,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("realpath-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("realpath-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_QUIET) Arg::new(OPT_QUIET)

View file

@ -90,9 +90,7 @@ impl Default for Options {
} }
} }
const ABOUT: &str = help_about!("rm.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("rm.md");
const AFTER_HELP: &str = help_section!("after help", "rm.md");
static OPT_DIR: &str = "dir"; static OPT_DIR: &str = "dir";
static OPT_INTERACTIVE: &str = "interactive"; static OPT_INTERACTIVE: &str = "interactive";
@ -202,9 +200,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("rm-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("rm-usage")))
.after_help(AFTER_HELP) .after_help(get_message("rm-after-help"))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(

View file

@ -16,8 +16,7 @@ use uucore::error::{UResult, set_exit_code, strip_errno};
use uucore::{format_usage, help_about, help_usage, show_error, util_name}; use uucore::{format_usage, help_about, help_usage, show_error, util_name};
static ABOUT: &str = help_about!("rmdir.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("rmdir.md");
static OPT_IGNORE_FAIL_NON_EMPTY: &str = "ignore-fail-on-non-empty"; static OPT_IGNORE_FAIL_NON_EMPTY: &str = "ignore-fail-on-non-empty";
static OPT_PARENTS: &str = "parents"; static OPT_PARENTS: &str = "parents";
static OPT_VERBOSE: &str = "verbose"; static OPT_VERBOSE: &str = "verbose";
@ -165,8 +164,8 @@ struct Opts {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(util_name()) Command::new(util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("rmdir-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("rmdir-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_IGNORE_FAIL_NON_EMPTY) Arg::new(OPT_IGNORE_FAIL_NON_EMPTY)

View file

@ -23,8 +23,7 @@ mod errors;
use errors::error_exit_status; use errors::error_exit_status;
use errors::{Error, Result, RunconError}; use errors::{Error, Result, RunconError};
const ABOUT: &str = help_about!("runcon.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("runcon.md");
const DESCRIPTION: &str = help_section!("after help", "runcon.md"); const DESCRIPTION: &str = help_section!("after help", "runcon.md");
pub mod options { pub mod options {
@ -90,9 +89,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("runcon-about"))
.after_help(DESCRIPTION) .after_help(DESCRIPTION)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("runcon-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::COMPUTE) Arg::new(options::COMPUTE)

View file

@ -28,8 +28,7 @@ mod numberparse;
use crate::error::SeqError; use crate::error::SeqError;
use crate::number::PreciseNumber; use crate::number::PreciseNumber;
const ABOUT: &str = help_about!("seq.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("seq.md");
const OPT_SEPARATOR: &str = "separator"; const OPT_SEPARATOR: &str = "separator";
const OPT_TERMINATOR: &str = "terminator"; const OPT_TERMINATOR: &str = "terminator";
@ -222,8 +221,8 @@ pub fn uu_app() -> Command {
.trailing_var_arg(true) .trailing_var_arg(true)
.infer_long_args(true) .infer_long_args(true)
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("seq-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("seq-usage")))
.arg( .arg(
Arg::new(OPT_SEPARATOR) Arg::new(OPT_SEPARATOR)
.short('s') .short('s')

View file

@ -20,9 +20,7 @@ use uucore::parser::parse_size::parse_size_u64;
use uucore::parser::shortcut_value_parser::ShortcutValueParser; use uucore::parser::shortcut_value_parser::ShortcutValueParser;
use uucore::{format_usage, help_about, help_section, help_usage, show_error, show_if_err}; use uucore::{format_usage, help_about, help_section, help_usage, show_error, show_if_err};
const ABOUT: &str = help_about!("shred.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("shred.md");
const AFTER_HELP: &str = help_section!("after help", "shred.md");
pub mod options { pub mod options {
pub const FORCE: &str = "force"; pub const FORCE: &str = "force";
@ -316,9 +314,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("shred-about"))
.after_help(AFTER_HELP) .after_help(get_message("shred-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("shred-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FORCE) Arg::new(options::FORCE)

View file

@ -30,7 +30,7 @@ enum Mode {
} }
static USAGE: &str = help_usage!("shuf.md"); static USAGE: &str = help_usage!("shuf.md");
static ABOUT: &str = help_about!("shuf.md"); use uucore::locale::{self, get_message};
struct Options { struct Options {
head_count: usize, head_count: usize,
@ -143,9 +143,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.about(ABOUT) .about(get_message("shuf-about"))
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("shuf-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::ECHO) Arg::new(options::ECHO)

View file

@ -15,8 +15,7 @@ use uucore::{
use clap::{Arg, ArgAction, Command}; use clap::{Arg, ArgAction, Command};
static ABOUT: &str = help_about!("sleep.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("sleep.md");
static AFTER_HELP: &str = help_section!("after help", "sleep.md"); static AFTER_HELP: &str = help_section!("after help", "sleep.md");
mod options { mod options {
@ -47,9 +46,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("sleep-about"))
.after_help(AFTER_HELP) .after_help(get_message("sleep-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("sleep-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::NUMBER) Arg::new(options::NUMBER)

View file

@ -52,9 +52,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error};
use crate::tmp_dir::TmpDirWrapper; use crate::tmp_dir::TmpDirWrapper;
const ABOUT: &str = help_about!("sort.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("sort.md");
const AFTER_HELP: &str = help_section!("after help", "sort.md");
mod options { mod options {
pub mod modes { pub mod modes {
@ -1340,9 +1338,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("sort-about"))
.after_help(AFTER_HELP) .after_help(get_message("sort-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("sort-usage")))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.disable_version_flag(true) .disable_version_flag(true)

View file

@ -46,9 +46,7 @@ static OPT_IO_BLKSIZE: &str = "-io-blksize";
static ARG_INPUT: &str = "input"; static ARG_INPUT: &str = "input";
static ARG_PREFIX: &str = "prefix"; static ARG_PREFIX: &str = "prefix";
const ABOUT: &str = help_about!("split.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("split.md");
const AFTER_HELP: &str = help_section!("after help", "split.md");
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -229,9 +227,9 @@ fn handle_preceding_options(
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("split-about"))
.after_help(AFTER_HELP) .after_help(get_message("split-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("split-usage")))
.infer_long_args(true) .infer_long_args(true)
// strategy (mutually exclusive) // strategy (mutually exclusive)
.arg( .arg(

View file

@ -28,8 +28,7 @@ use std::os::unix::prelude::OsStrExt;
use std::path::Path; use std::path::Path;
use std::{env, fs}; use std::{env, fs};
const ABOUT: &str = help_about!("stat.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("stat.md");
const LONG_USAGE: &str = help_section!("long usage", "stat.md"); const LONG_USAGE: &str = help_section!("long usage", "stat.md");
mod options { mod options {
@ -1149,8 +1148,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("stat-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("stat-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::DEREFERENCE) Arg::new(options::DEREFERENCE)

View file

@ -14,11 +14,11 @@ use std::process;
use tempfile::TempDir; use tempfile::TempDir;
use tempfile::tempdir; use tempfile::tempdir;
use uucore::error::{FromIo, UClapError, UResult, USimpleError, UUsageError}; use uucore::error::{FromIo, UClapError, UResult, USimpleError, UUsageError};
use uucore::format_usage;
use uucore::parser::parse_size::parse_size_u64; use uucore::parser::parse_size::parse_size_u64;
use uucore::{format_usage, help_about, help_section, help_usage}; use uucore::{format_usage, help_about, help_section, help_usage};
const ABOUT: &str = help_about!("stdbuf.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("stdbuf.md");
const LONG_HELP: &str = help_section!("after help", "stdbuf.md"); const LONG_HELP: &str = help_section!("after help", "stdbuf.md");
mod options { mod options {
@ -204,9 +204,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("stdbuf-about"))
.after_help(LONG_HELP) .after_help(get_message("stdbuf-after-help"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("stdbuf-usage")))
.trailing_var_arg(true) .trailing_var_arg(true)
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(

View file

@ -21,6 +21,7 @@ use std::os::fd::{AsFd, BorrowedFd};
use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::OpenOptionsExt;
use std::os::unix::io::{AsRawFd, RawFd}; use std::os::unix::io::{AsRawFd, RawFd};
use uucore::error::{UResult, USimpleError}; use uucore::error::{UResult, USimpleError};
use uucore::locale::get_message;
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
#[cfg(not(any( #[cfg(not(any(
@ -34,9 +35,6 @@ use uucore::{format_usage, help_about, help_usage};
use flags::BAUD_RATES; use flags::BAUD_RATES;
use flags::{CONTROL_CHARS, CONTROL_FLAGS, INPUT_FLAGS, LOCAL_FLAGS, OUTPUT_FLAGS}; use flags::{CONTROL_CHARS, CONTROL_FLAGS, INPUT_FLAGS, LOCAL_FLAGS, OUTPUT_FLAGS};
const USAGE: &str = help_usage!("stty.md");
const SUMMARY: &str = help_about!("stty.md");
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct Flag<T> { pub struct Flag<T> {
name: &'static str, name: &'static str,
@ -476,8 +474,8 @@ fn apply_baud_rate_flag(termios: &mut Termios, input: &str) -> ControlFlow<bool>
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("stty-usage")))
.about(SUMMARY) .about(get_message("stty-about"))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::ALL) Arg::new(options::ALL)

View file

@ -13,8 +13,7 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UResult, USimpleError}; use uucore::error::{FromIo, UResult, USimpleError};
use uucore::{format_usage, help_about, help_usage, show}; use uucore::{format_usage, help_about, help_usage, show};
const USAGE: &str = help_usage!("sum.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("sum.md");
fn bsd_sum(mut reader: impl Read) -> std::io::Result<(usize, u16)> { fn bsd_sum(mut reader: impl Read) -> std::io::Result<(usize, u16)> {
let mut buf = [0; 4096]; let mut buf = [0; 4096];
@ -138,8 +137,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("sum-usage")))
.about(ABOUT) .about(get_message("sum-about"))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)

View file

@ -19,8 +19,7 @@ use uucore::error::FromIo;
use uucore::error::{UResult, USimpleError}; use uucore::error::{UResult, USimpleError};
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("sync.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("sync.md");
pub mod options { pub mod options {
pub static FILE_SYSTEM: &str = "file-system"; pub static FILE_SYSTEM: &str = "file-system";
@ -222,8 +221,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("sync-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("sync-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE_SYSTEM) Arg::new(options::FILE_SYSTEM)

View file

@ -22,7 +22,7 @@ use uucore::{format_usage, help_about, help_usage, show};
use crate::error::TacError; use crate::error::TacError;
static USAGE: &str = help_usage!("tac.md"); static USAGE: &str = help_usage!("tac.md");
static ABOUT: &str = help_about!("tac.md"); use uucore::locale::{self, get_message};
mod options { mod options {
pub static BEFORE: &str = "before"; pub static BEFORE: &str = "before";
@ -58,8 +58,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("tac-usage")))
.about(ABOUT) .about(get_message("tac-about"))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BEFORE) Arg::new(options::BEFORE)

View file

@ -18,8 +18,7 @@ use uucore::parser::parse_time;
use uucore::parser::shortcut_value_parser::ShortcutValueParser; use uucore::parser::shortcut_value_parser::ShortcutValueParser;
use uucore::{format_usage, help_about, help_usage, show_warning}; use uucore::{format_usage, help_about, help_usage, show_warning};
const ABOUT: &str = help_about!("tail.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("tail.md");
pub mod options { pub mod options {
pub mod verbosity { pub mod verbosity {
@ -464,8 +463,8 @@ pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("tail-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("tail-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BYTES) Arg::new(options::BYTES)

View file

@ -19,9 +19,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error};
#[cfg(unix)] #[cfg(unix)]
use uucore::signals::{enable_pipe_errors, ignore_interrupts}; use uucore::signals::{enable_pipe_errors, ignore_interrupts};
const ABOUT: &str = help_about!("tee.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("tee.md");
const AFTER_HELP: &str = help_section!("after help", "tee.md");
mod options { mod options {
pub const APPEND: &str = "append"; pub const APPEND: &str = "append";
@ -97,9 +95,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("tee-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("tee-usage")))
.after_help(AFTER_HELP) .after_help(get_message("tee-after-help"))
.infer_long_args(true) .infer_long_args(true)
// Since we use value-specific help texts for "--output-error", clap's "short help" and "long help" differ. // Since we use value-specific help texts for "--output-error", clap's "short help" and "long help" differ.
// However, this is something that the GNU tests explicitly test for, so we *always* show the long help instead. // However, this is something that the GNU tests explicitly test for, so we *always* show the long help instead.

View file

@ -21,31 +21,23 @@ use uucore::error::{UResult, USimpleError};
use uucore::process::{getegid, geteuid}; use uucore::process::{getegid, geteuid};
use uucore::{format_usage, help_about, help_section}; use uucore::{format_usage, help_about, help_section};
const ABOUT: &str = help_about!("test.md"); use uucore::locale::{self, get_message};
// The help_usage method replaces util name (the first word) with {}. // The help_usage method replaces util name (the first word) with {}.
// And, The format_usage method replaces {} with execution_phrase ( e.g. test or [ ). // And, The format_usage method replaces {} with execution_phrase ( e.g. test or [ ).
// However, This test command has two util names. // However, This test command has two util names.
// So, we use test or [ instead of {} so that the usage string is correct. // So, we use test or [ instead of {} so that the usage string is correct.
const USAGE: &str = "\
test EXPRESSION
[
[ EXPRESSION ]
[ ]
[ OPTION
]";
// We use after_help so that this comes after the usage string (it would come before if we used about) // We use after_help so that this comes after the usage string (it would come before if we used about)
const AFTER_HELP: &str = help_section!("after help", "test.md");
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
// Disable printing of -h and -v as valid alternatives for --help and --version, // Disable printing of -h and -v as valid alternatives for --help and --version,
// since we don't recognize -h and -v as help/version flags. // since we don't recognize -h and -v as help/version flags.
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("test-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("test-usage")))
.after_help(AFTER_HELP) .after_help(get_message("test-after-help"))
} }
#[uucore::main] #[uucore::main]

View file

@ -25,8 +25,7 @@ use uucore::{
signals::{signal_by_name_or_value, signal_name_by_value}, signals::{signal_by_name_or_value, signal_name_by_value},
}; };
const ABOUT: &str = help_about!("timeout.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("timeout.md");
pub mod options { pub mod options {
pub static FOREGROUND: &str = "foreground"; pub static FOREGROUND: &str = "foreground";
@ -122,8 +121,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new("timeout") Command::new("timeout")
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("timeout-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("timeout-usage")))
.arg( .arg(
Arg::new(options::FOREGROUND) Arg::new(options::FOREGROUND)
.long(options::FOREGROUND) .long(options::FOREGROUND)

View file

@ -83,8 +83,7 @@ pub enum Source {
Now, Now,
} }
const ABOUT: &str = help_about!("touch.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("touch.md");
pub mod options { pub mod options {
// Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup. // Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup.
@ -258,8 +257,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("touch-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("touch-usage")))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.arg( .arg(

View file

@ -20,9 +20,7 @@ use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
use uucore::fs::is_stdin_directory; use uucore::fs::is_stdin_directory;
use uucore::{format_usage, help_about, help_section, help_usage, os_str_as_bytes, show}; use uucore::{format_usage, help_about, help_section, help_usage, os_str_as_bytes, show};
const ABOUT: &str = help_about!("tr.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "tr.md");
const USAGE: &str = help_usage!("tr.md");
mod options { mod options {
pub const COMPLEMENT: &str = "complement"; pub const COMPLEMENT: &str = "complement";
@ -34,7 +32,9 @@ mod options {
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?; let matches = uu_app()
.after_help(get_message("tr-after-help"))
.try_get_matches_from(args)?;
let delete_flag = matches.get_flag(options::DELETE); let delete_flag = matches.get_flag(options::DELETE);
let complement_flag = matches.get_flag(options::COMPLEMENT); let complement_flag = matches.get_flag(options::COMPLEMENT);
@ -164,8 +164,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("tr-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("tr-usage")))
.infer_long_args(true) .infer_long_args(true)
.trailing_var_arg(true) .trailing_var_arg(true)
.arg( .arg(

View file

@ -7,7 +7,7 @@ use std::{ffi::OsString, io::Write};
use uucore::error::{UResult, set_exit_code}; use uucore::error::{UResult, set_exit_code};
use uucore::help_about; use uucore::help_about;
const ABOUT: &str = help_about!("true.md"); use uucore::locale::{self, get_message};
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -43,7 +43,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("true-about"))
// We provide our own help and version options, to ensure maximum compatibility with GNU. // We provide our own help and version options, to ensure maximum compatibility with GNU.
.disable_help_flag(true) .disable_help_flag(true)
.disable_version_flag(true) .disable_version_flag(true)

View file

@ -71,9 +71,7 @@ impl TruncateMode {
} }
} }
const ABOUT: &str = help_about!("truncate.md"); use uucore::locale::{self, get_message};
const AFTER_HELP: &str = help_section!("after help", "truncate.md");
const USAGE: &str = help_usage!("truncate.md");
pub mod options { pub mod options {
pub static IO_BLOCKS: &str = "io-blocks"; pub static IO_BLOCKS: &str = "io-blocks";
@ -86,7 +84,7 @@ pub mod options {
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app() let matches = uu_app()
.after_help(AFTER_HELP) .after_help(get_message("truncate-after-help"))
.try_get_matches_from(args) .try_get_matches_from(args)
.map_err(|e| { .map_err(|e| {
e.print().expect("Error writing clap::Error"); e.print().expect("Error writing clap::Error");
@ -117,8 +115,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("truncate-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("truncate-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::IO_BLOCKS) Arg::new(options::IO_BLOCKS)

View file

@ -11,8 +11,7 @@ use uucore::display::Quotable;
use uucore::error::{UError, UResult}; use uucore::error::{UError, UResult};
use uucore::{format_usage, help_about, help_usage, show}; use uucore::{format_usage, help_about, help_usage, show};
const ABOUT: &str = help_about!("tsort.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("tsort.md");
mod options { mod options {
pub const FILE: &str = "file"; pub const FILE: &str = "file";
@ -76,8 +75,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("tsort-usage")))
.about(ABOUT) .about(get_message("tsort-about"))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)

View file

@ -12,8 +12,7 @@ use std::io::{IsTerminal, Write};
use uucore::error::{UResult, set_exit_code}; use uucore::error::{UResult, set_exit_code};
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("tty.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("tty.md");
mod options { mod options {
pub const SILENT: &str = "silent"; pub const SILENT: &str = "silent";
@ -58,8 +57,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("tty-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("tty-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::SILENT) Arg::new(options::SILENT)

View file

@ -12,8 +12,7 @@ use uucore::{
format_usage, help_about, help_usage, format_usage, help_about, help_usage,
}; };
const ABOUT: &str = help_about!("uname.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("uname.md");
pub mod options { pub mod options {
pub static ALL: &str = "all"; pub static ALL: &str = "all";
@ -146,8 +145,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("uname-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("uname-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::ALL) Arg::new(options::ALL)

View file

@ -17,8 +17,7 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UError, UResult, USimpleError}; use uucore::error::{FromIo, UError, UResult, USimpleError};
use uucore::{format_usage, help_about, help_usage, show}; use uucore::{format_usage, help_about, help_usage, show};
const USAGE: &str = help_usage!("unexpand.md"); use uucore::locale::{self, get_message};
const ABOUT: &str = help_about!("unexpand.md");
const DEFAULT_TABSTOP: usize = 8; const DEFAULT_TABSTOP: usize = 8;
@ -157,8 +156,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("unexpand-usage")))
.about(ABOUT) .about(get_message("unexpand-about"))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)

View file

@ -17,9 +17,7 @@ use uucore::parser::shortcut_value_parser::ShortcutValueParser;
use uucore::posix::{OBSOLETE, posix_version}; use uucore::posix::{OBSOLETE, posix_version};
use uucore::{format_usage, help_about, help_section, help_usage}; use uucore::{format_usage, help_about, help_section, help_usage};
const ABOUT: &str = help_about!("uniq.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("uniq.md");
const AFTER_HELP: &str = help_section!("after help", "uniq.md");
pub mod options { pub mod options {
pub static ALL_REPEATED: &str = "all-repeated"; pub static ALL_REPEATED: &str = "all-repeated";
@ -593,10 +591,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("uniq-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("uniq-usage")))
.infer_long_args(true) .infer_long_args(true)
.after_help(AFTER_HELP) .after_help(get_message("uniq-after-help"))
.arg( .arg(
Arg::new(options::ALL_REPEATED) Arg::new(options::ALL_REPEATED)
.short('D') .short('D')

View file

@ -14,8 +14,7 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UResult}; use uucore::error::{FromIo, UResult};
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("unlink.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("unlink.md");
static OPT_PATH: &str = "FILE"; static OPT_PATH: &str = "FILE";
#[uucore::main] #[uucore::main]
@ -30,8 +29,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("unlink-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("unlink-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_PATH) Arg::new(OPT_PATH)

View file

@ -31,9 +31,7 @@ const ABOUT: &str = concat!(
); );
#[cfg(not(target_env = "musl"))] #[cfg(not(target_env = "musl"))]
const ABOUT: &str = help_about!("uptime.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("uptime.md");
pub mod options { pub mod options {
pub static SINCE: &str = "since"; pub static SINCE: &str = "since";
@ -78,8 +76,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
let cmd = Command::new(uucore::util_name()) let cmd = Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("uptime-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("uptime-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::SINCE) Arg::new(options::SINCE)

View file

@ -26,9 +26,7 @@ const ABOUT: &str = concat!(
); );
#[cfg(not(target_env = "musl"))] #[cfg(not(target_env = "musl"))]
const ABOUT: &str = help_about!("users.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("users.md");
#[cfg(target_os = "openbsd")] #[cfg(target_os = "openbsd")]
const OPENBSD_UTMP_FILE: &str = "/var/run/utmp"; const OPENBSD_UTMP_FILE: &str = "/var/run/utmp";
@ -97,8 +95,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("users-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("users-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(ARG_FILE) Arg::new(ARG_FILE)

View file

@ -113,8 +113,7 @@ impl<'a> Settings<'a> {
} }
} }
const ABOUT: &str = help_about!("wc.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("wc.md");
mod options { mod options {
pub static BYTES: &str = "bytes"; pub static BYTES: &str = "bytes";
@ -397,8 +396,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("wc-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("wc-usage")))
.infer_long_args(true) .infer_long_args(true)
.args_override_self(true) .args_override_self(true)
.arg( .arg(

View file

@ -37,9 +37,7 @@ const ABOUT: &str = concat!(
); );
#[cfg(not(target_env = "musl"))] #[cfg(not(target_env = "musl"))]
const ABOUT: &str = help_about!("who.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("who.md");
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
static RUNLEVEL_HELP: &str = "print current runlevel"; static RUNLEVEL_HELP: &str = "print current runlevel";
@ -52,8 +50,8 @@ use platform::uumain;
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("who-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("who-usage")))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(
Arg::new(options::ALL) Arg::new(options::ALL)

View file

@ -13,8 +13,7 @@ use uucore::{format_usage, help_about, help_usage};
mod platform; mod platform;
const ABOUT: &str = help_about!("whoami.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("whoami.md");
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -32,7 +31,7 @@ pub fn whoami() -> UResult<OsString> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("whoami-about"))
.override_usage(format_usage(USAGE)) .override_usage(uucore::util_name())
.infer_long_args(true) .infer_long_args(true)
} }

View file

@ -14,8 +14,7 @@ use uucore::error::{UResult, USimpleError};
use uucore::signals::enable_pipe_errors; use uucore::signals::enable_pipe_errors;
use uucore::{format_usage, help_about, help_usage}; use uucore::{format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("yes.md"); use uucore::locale::{self, get_message};
const USAGE: &str = help_usage!("yes.md");
// 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
// systems, but honestly this is good enough // systems, but honestly this is good enough
@ -39,8 +38,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(ABOUT) .about(get_message("yes-about"))
.override_usage(format_usage(USAGE)) .override_usage(format_usage(&get_message("yes-usage")))
.arg( .arg(
Arg::new("STRING") Arg::new("STRING")
.value_parser(ValueParser::os_string()) .value_parser(ValueParser::os_string())