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:
parent
42cfb3d8be
commit
d8bb7875cf
98 changed files with 362 additions and 478 deletions
|
@ -5,24 +5,25 @@
|
|||
|
||||
pub mod base_common;
|
||||
|
||||
use base_common::ReadSeek;
|
||||
use clap::Command;
|
||||
use uucore::{encoding::Format, error::UResult, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("base32.md");
|
||||
const USAGE: &str = help_usage!("base32.md");
|
||||
use uucore::{encoding::Format, error::UResult, locale::get_message};
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let format = Format::Base32;
|
||||
|
||||
let config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?;
|
||||
|
||||
let mut input: Box<dyn ReadSeek> = base_common::get_input(&config)?;
|
||||
|
||||
let (about, usage) = get_info();
|
||||
let config = base_common::parse_base_cmd_args(args, about, usage)?;
|
||||
let mut input = base_common::get_input(&config)?;
|
||||
base_common::handle_input(&mut input, format, config)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -5,22 +5,24 @@
|
|||
|
||||
use clap::Command;
|
||||
use uu_base32::base_common;
|
||||
use uucore::{encoding::Format, error::UResult, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("base64.md");
|
||||
const USAGE: &str = help_usage!("base64.md");
|
||||
use uucore::{encoding::Format, error::UResult, locale::get_message};
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let format = Format::Base64;
|
||||
|
||||
let config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?;
|
||||
|
||||
let (about, usage) = get_info();
|
||||
let config = base_common::parse_base_cmd_args(args, about, usage)?;
|
||||
let mut input = base_common::get_input(&config)?;
|
||||
|
||||
base_common::handle_input(&mut input, format, config)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@ use uucore::error::{UResult, UUsageError};
|
|||
use uucore::line_ending::LineEnding;
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
static ABOUT: &str = help_about!("basename.md");
|
||||
|
||||
const USAGE: &str = help_usage!("basename.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static MULTIPLE: &str = "multiple";
|
||||
|
@ -77,8 +75,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("basename-about"))
|
||||
.override_usage(format_usage(&get_message("basename-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::MULTIPLE)
|
||||
|
|
|
@ -8,15 +8,11 @@
|
|||
use clap::{Arg, ArgAction, Command};
|
||||
use uu_base32::base_common::{self, BASE_CMD_PARSE_ERROR, Config};
|
||||
use uucore::error::UClapError;
|
||||
use uucore::locale::get_message;
|
||||
use uucore::{
|
||||
encoding::Format,
|
||||
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)] = &[
|
||||
("base64", Format::Base64, "same as 'base64' program"),
|
||||
("base64url", Format::Base64Url, "file- and url-safe base64"),
|
||||
|
@ -47,7 +43,10 @@ const ENCODINGS: &[(&str, Format, &str)] = &[
|
|||
];
|
||||
|
||||
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 {
|
||||
let raw_arg = Arg::new(encoding.0)
|
||||
.long(encoding.0)
|
||||
|
|
|
@ -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"))]
|
||||
mod splice;
|
||||
|
||||
const USAGE: &str = help_usage!("cat.md");
|
||||
const ABOUT: &str = help_about!("cat.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
// Allocate 32 digits for the line number.
|
||||
// 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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("cat-usage")))
|
||||
.about(get_message("cat-about"))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
|
|
@ -24,8 +24,7 @@ mod fts;
|
|||
|
||||
use errors::*;
|
||||
|
||||
const ABOUT: &str = help_about!("chcon.md");
|
||||
const USAGE: &str = help_usage!("chcon.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static HELP: &str = "help";
|
||||
|
@ -151,8 +150,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("chcon-about"))
|
||||
.override_usage(format_usage(&get_message("chcon-usage")))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.args_override_self(true)
|
||||
|
|
|
@ -16,8 +16,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command};
|
|||
use std::fs;
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
const ABOUT: &str = help_about!("chgrp.md");
|
||||
const USAGE: &str = help_usage!("chgrp.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
fn parse_gid_from_str(group: &str) -> Result<u32, String> {
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("chgrp-about"))
|
||||
.override_usage(format_usage(&get_message("chgrp-usage")))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.arg(
|
||||
|
|
|
@ -19,8 +19,7 @@ use uucore::mode;
|
|||
use uucore::perms::{TraverseSymlinks, configure_symlink_and_recursion};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show, show_error};
|
||||
|
||||
const ABOUT: &str = help_about!("chmod.md");
|
||||
const USAGE: &str = help_usage!("chmod.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const LONG_USAGE: &str = help_section!("after help", "chmod.md");
|
||||
|
||||
mod options {
|
||||
|
@ -159,8 +158,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("chmod-about"))
|
||||
.override_usage(format_usage(&get_message("chmod-usage")))
|
||||
.args_override_self(true)
|
||||
.infer_long_args(true)
|
||||
.no_binary_name(true)
|
||||
|
|
|
@ -17,9 +17,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command};
|
|||
use std::fs;
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
static ABOUT: &str = help_about!("chown.md");
|
||||
|
||||
const USAGE: &str = help_usage!("chown.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
fn parse_gid_uid_and_filter(matches: &ArgMatches) -> UResult<GidUidOwnerFilter> {
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("chown-about"))
|
||||
.override_usage(format_usage(&get_message("chown-usage")))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.arg(
|
||||
|
|
|
@ -19,7 +19,7 @@ use uucore::fs::{MissingHandling, ResolveMode, canonicalize};
|
|||
use uucore::libc::{self, chroot, setgid, setgroups, setuid};
|
||||
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");
|
||||
|
||||
mod options {
|
||||
|
@ -237,8 +237,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("chroot-about"))
|
||||
.override_usage(format_usage(&get_message("chroot-usage")))
|
||||
.infer_long_args(true)
|
||||
.trailing_var_arg(true)
|
||||
.arg(
|
||||
|
|
|
@ -26,9 +26,7 @@ use uucore::{
|
|||
sum::Digest,
|
||||
};
|
||||
|
||||
const USAGE: &str = help_usage!("cksum.md");
|
||||
const ABOUT: &str = help_about!("cksum.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "cksum.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
enum OutputFormat {
|
||||
|
@ -343,8 +341,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("cksum-about"))
|
||||
.override_usage(format_usage(&get_message("cksum-usage")))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
@ -468,7 +466,7 @@ pub fn uu_app() -> Command {
|
|||
)
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.after_help(AFTER_HELP)
|
||||
.after_help(get_message("cksum-after-help"))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -15,8 +15,7 @@ use uucore::{format_usage, help_about, help_usage};
|
|||
|
||||
use clap::{Arg, ArgAction, ArgMatches, Command};
|
||||
|
||||
const ABOUT: &str = help_about!("comm.md");
|
||||
const USAGE: &str = help_usage!("comm.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const COLUMN_1: &str = "1";
|
||||
|
@ -314,8 +313,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("comm-about"))
|
||||
.override_usage(format_usage(&get_message("comm-usage")))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
|
|
@ -451,9 +451,7 @@ fn show_debug(copy_debug: &CopyDebug) {
|
|||
);
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("cp.md");
|
||||
const USAGE: &str = help_usage!("cp.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "cp.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static EXIT_ERR: i32 = 1;
|
||||
|
||||
|
@ -523,10 +521,11 @@ pub fn uu_app() -> Command {
|
|||
];
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("cp-about"))
|
||||
.override_usage(format_usage(&get_message("cp-usage")))
|
||||
.after_help(format!(
|
||||
"{AFTER_HELP}\n\n{}",
|
||||
"{}\n\n{}",
|
||||
get_message("cp-after-help"),
|
||||
backup_control::BACKUP_CONTROL_LONG_HELP
|
||||
))
|
||||
.infer_long_args(true)
|
||||
|
|
|
@ -25,9 +25,7 @@ mod split_name;
|
|||
use crate::csplit_error::CsplitError;
|
||||
use crate::split_name::SplitName;
|
||||
|
||||
const ABOUT: &str = help_about!("csplit.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "csplit.md");
|
||||
const USAGE: &str = help_usage!("csplit.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const SUFFIX_FORMAT: &str = "suffix-format";
|
||||
|
@ -631,8 +629,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("csplit-about"))
|
||||
.override_usage(format_usage(&get_message("csplit-usage")))
|
||||
.args_override_self(true)
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
|
@ -697,7 +695,7 @@ pub fn uu_app() -> Command {
|
|||
.action(ArgAction::Append)
|
||||
.required(true),
|
||||
)
|
||||
.after_help(AFTER_HELP)
|
||||
.after_help(get_message("csplit-after-help"))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -24,9 +24,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error, sho
|
|||
mod matcher;
|
||||
mod searcher;
|
||||
|
||||
const USAGE: &str = help_usage!("cut.md");
|
||||
const ABOUT: &str = help_about!("cut.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "cut.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
struct Options<'a> {
|
||||
out_delimiter: Option<&'a [u8]>,
|
||||
|
@ -580,9 +578,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(&get_message("cut-usage")))
|
||||
.about(get_message("cut-about"))
|
||||
.after_help(get_message("cut-after-help"))
|
||||
.infer_long_args(true)
|
||||
// While `args_override_self(true)` for some arguments, such as `-d`
|
||||
// and `--output-delimiter`, is consistent to the behavior of GNU cut,
|
||||
|
|
|
@ -30,8 +30,7 @@ const MINUTES: &str = "minutes";
|
|||
const SECONDS: &str = "seconds";
|
||||
const NS: &str = "ns";
|
||||
|
||||
const ABOUT: &str = help_about!("date.md");
|
||||
const USAGE: &str = help_usage!("date.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
const OPT_DATE: &str = "date";
|
||||
const OPT_FORMAT: &str = "format";
|
||||
|
@ -290,8 +289,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("date-about"))
|
||||
.override_usage(format_usage(&get_message("date-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_DATE)
|
||||
|
|
|
@ -62,9 +62,7 @@ use uucore::error::{USimpleError, set_exit_code};
|
|||
use uucore::show_if_err;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
||||
|
||||
const ABOUT: &str = help_about!("dd.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "dd.md");
|
||||
const USAGE: &str = help_usage!("dd.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const BUF_INIT_BYTE: u8 = 0xDD;
|
||||
|
||||
/// Final settings after parsing
|
||||
|
@ -1427,9 +1425,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.about(get_message("dd-about"))
|
||||
.override_usage(format_usage(&get_message("dd-usage")))
|
||||
.after_help(get_message("dd-after-help"))
|
||||
.infer_long_args(true)
|
||||
.arg(Arg::new(options::OPERANDS).num_args(1..))
|
||||
}
|
||||
|
|
|
@ -29,9 +29,7 @@ use crate::filesystem::Filesystem;
|
|||
use crate::filesystem::FsError;
|
||||
use crate::table::Table;
|
||||
|
||||
const ABOUT: &str = help_about!("df.md");
|
||||
const USAGE: &str = help_usage!("df.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "df.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static OPT_HELP: &str = "help";
|
||||
static OPT_ALL: &str = "all";
|
||||
|
@ -452,9 +450,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.about(get_message("df-about"))
|
||||
.override_usage(format_usage(&get_message("df-usage")))
|
||||
.after_help(get_message("df-after-help"))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.arg(
|
||||
|
|
|
@ -26,9 +26,7 @@ mod options {
|
|||
pub const FILE: &str = "FILE";
|
||||
}
|
||||
|
||||
const USAGE: &str = help_usage!("dircolors.md");
|
||||
const ABOUT: &str = help_about!("dircolors.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "dircolors.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum OutputFmt {
|
||||
|
@ -245,9 +243,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("dircolors-about"))
|
||||
.after_help(get_message("dircolors-after-help"))
|
||||
.override_usage(format_usage(&get_message("dircolors-usage")))
|
||||
.args_override_self(true)
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
|
|
|
@ -10,9 +10,7 @@ use uucore::error::{UResult, UUsageError};
|
|||
use uucore::line_ending::LineEnding;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("dirname.md");
|
||||
const USAGE: &str = help_usage!("dirname.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "dirname.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const ZERO: &str = "zero";
|
||||
|
@ -21,7 +19,9 @@ mod options {
|
|||
|
||||
#[uucore::main]
|
||||
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));
|
||||
|
||||
|
@ -61,9 +61,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.about(ABOUT)
|
||||
.about(get_message("dirname-about"))
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.override_usage(format_usage(&get_message("dirname-usage")))
|
||||
.args_override_self(true)
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
|
|
|
@ -70,9 +70,7 @@ mod options {
|
|||
pub const FILE: &str = "FILE";
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("du.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "du.md");
|
||||
const USAGE: &str = help_usage!("du.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
struct TraversalOptions {
|
||||
all: bool,
|
||||
|
@ -824,9 +822,9 @@ fn parse_depth(max_depth_str: Option<&str>, summarize: bool) -> UResult<Option<u
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("du-about"))
|
||||
.after_help(get_message("du-after-help"))
|
||||
.override_usage(format_usage(&get_message("du-usage")))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.arg(
|
||||
|
|
|
@ -12,9 +12,7 @@ use uucore::error::{UResult, USimpleError};
|
|||
use uucore::format::{FormatChar, OctalParsing, parse_escape_only};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("echo.md");
|
||||
const USAGE: &str = help_usage!("echo.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "echo.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const STRING: &str = "STRING";
|
||||
|
@ -141,9 +139,9 @@ pub fn uu_app() -> Command {
|
|||
.trailing_var_arg(true)
|
||||
.allow_hyphen_values(true)
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("echo-about"))
|
||||
.after_help(get_message("echo-after-help"))
|
||||
.override_usage(format_usage(&get_message("echo-usage")))
|
||||
.arg(
|
||||
Arg::new(options::NO_NEWLINE)
|
||||
.short('n')
|
||||
|
|
10
src/uu/env/src/env.rs
vendored
10
src/uu/env/src/env.rs
vendored
|
@ -74,9 +74,7 @@ impl From<string_parser::Error> for EnvError {
|
|||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("env.md");
|
||||
const USAGE: &str = help_usage!("env.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "env.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const IGNORE_ENVIRONMENT: &str = "ignore-environment";
|
||||
|
@ -222,9 +220,9 @@ fn load_config_file(opts: &mut Options) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(crate_name!())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.about(get_message("env-about"))
|
||||
.override_usage(format_usage(&get_message("env-usage")))
|
||||
.after_help(get_message("env-after-help"))
|
||||
.infer_long_args(true)
|
||||
.trailing_var_arg(true)
|
||||
.arg(
|
||||
|
|
|
@ -18,8 +18,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{FromIo, UError, UResult, set_exit_code};
|
||||
use uucore::{format_usage, help_about, help_usage, show_error};
|
||||
|
||||
const ABOUT: &str = help_about!("expand.md");
|
||||
const USAGE: &str = help_usage!("expand.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static TABS: &str = "tabs";
|
||||
|
@ -253,9 +252,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.about(get_message("expand-about"))
|
||||
.after_help(LONG_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.override_usage(format_usage(&get_message("expand-usage")))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
|
|
@ -16,8 +16,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{FromIo, UResult, USimpleError, set_exit_code};
|
||||
use uucore::{format_usage, help_about, help_usage, show_error, show_warning};
|
||||
|
||||
const ABOUT: &str = help_about!("factor.md");
|
||||
const USAGE: &str = help_usage!("factor.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub static EXPONENTS: &str = "exponents";
|
||||
|
@ -122,8 +121,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("factor-about"))
|
||||
.override_usage(format_usage(&get_message("factor-usage")))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.args_override_self(true)
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::{ffi::OsString, io::Write};
|
|||
use uucore::error::{UResult, set_exit_code};
|
||||
use uucore::help_about;
|
||||
|
||||
const ABOUT: &str = help_about!("false.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[uucore::main]
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.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.
|
||||
.disable_help_flag(true)
|
||||
.disable_version_flag(true)
|
||||
|
|
|
@ -18,8 +18,7 @@ use parasplit::ParagraphStream;
|
|||
mod linebreak;
|
||||
mod parasplit;
|
||||
|
||||
const ABOUT: &str = help_about!("fmt.md");
|
||||
const USAGE: &str = help_usage!("fmt.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const MAX_WIDTH: usize = 2500;
|
||||
const DEFAULT_GOAL: usize = 70;
|
||||
const DEFAULT_WIDTH: usize = 75;
|
||||
|
@ -336,8 +335,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("fmt-about"))
|
||||
.override_usage(format_usage(&get_message("fmt-usage")))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
|
|
@ -15,8 +15,7 @@ use uucore::{format_usage, help_about, help_usage};
|
|||
|
||||
const TAB_WIDTH: usize = 8;
|
||||
|
||||
const USAGE: &str = help_usage!("fold.md");
|
||||
const ABOUT: &str = help_about!("fold.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const BYTES: &str = "bytes";
|
||||
|
@ -60,8 +59,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("fold-usage")))
|
||||
.about(get_message("fold-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::BYTES)
|
||||
|
|
|
@ -18,8 +18,7 @@ use clap::{Arg, ArgAction, Command};
|
|||
mod options {
|
||||
pub const USERS: &str = "USERNAME";
|
||||
}
|
||||
const ABOUT: &str = help_about!("groups.md");
|
||||
const USAGE: &str = help_usage!("groups.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
enum GroupsError {
|
||||
|
@ -82,8 +81,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("groups-about"))
|
||||
.override_usage(format_usage(&get_message("groups-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::USERS)
|
||||
|
|
|
@ -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};
|
||||
|
||||
const NAME: &str = "hashsum";
|
||||
const ABOUT: &str = help_about!("hashsum.md");
|
||||
const USAGE: &str = help_usage!("hashsum.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
struct Options {
|
||||
algoname: &'static str,
|
||||
|
@ -318,8 +317,8 @@ pub fn uu_app_common() -> Command {
|
|||
const TEXT_HELP: &str = "read in text mode (default)";
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("hashsum-about"))
|
||||
.override_usage(format_usage(&get_message("hashsum-usage")))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
|
|
@ -20,8 +20,7 @@ use uucore::{format_usage, help_about, help_usage, show};
|
|||
|
||||
const BUF_SIZE: usize = 65536;
|
||||
|
||||
const ABOUT: &str = help_about!("head.md");
|
||||
const USAGE: &str = help_usage!("head.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const BYTES_NAME: &str = "BYTES";
|
||||
|
@ -72,8 +71,8 @@ type HeadResult<T> = Result<T, HeadError>;
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("head-about"))
|
||||
.override_usage(format_usage(&get_message("head-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::BYTES_NAME)
|
||||
|
|
|
@ -9,8 +9,7 @@ use clap::Command;
|
|||
use libc::{c_long, gethostid};
|
||||
use uucore::{error::UResult, format_usage, help_about, help_usage};
|
||||
|
||||
const USAGE: &str = help_usage!("hostid.md");
|
||||
const ABOUT: &str = help_about!("hostid.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[uucore::main]
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("hostid-about"))
|
||||
.override_usage(format_usage(&get_message("hostid-usage")))
|
||||
.infer_long_args(true)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@ use uucore::{
|
|||
format_usage, help_about, help_usage,
|
||||
};
|
||||
|
||||
const ABOUT: &str = help_about!("hostname.md");
|
||||
const USAGE: &str = help_usage!("hostname.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static OPT_DOMAIN: &str = "domain";
|
||||
static OPT_IP_ADDRESS: &str = "ip-address";
|
||||
|
@ -76,8 +75,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("hostname-about"))
|
||||
.override_usage(format_usage(&get_message("hostname-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_DOMAIN)
|
||||
|
|
|
@ -59,9 +59,7 @@ macro_rules! cstr2cow {
|
|||
};
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("id.md");
|
||||
const USAGE: &str = help_usage!("id.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "id.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[cfg(not(feature = "selinux"))]
|
||||
static CONTEXT_HELP_TEXT: &str = "print only the security context of the process (not enabled)";
|
||||
|
@ -119,7 +117,9 @@ struct State {
|
|||
#[uucore::main]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
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
|
||||
.get_many::<String>(options::ARG_USERS)
|
||||
|
@ -327,8 +327,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("id-about"))
|
||||
.override_usage(format_usage(&get_message("id-usage")))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
|
|
@ -140,8 +140,7 @@ impl Behavior {
|
|||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("install.md");
|
||||
const USAGE: &str = help_usage!("install.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static OPT_COMPARE: &str = "compare";
|
||||
static OPT_DIRECTORY: &str = "directory";
|
||||
|
@ -185,8 +184,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("install-about"))
|
||||
.override_usage(format_usage(&get_message("install-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(backup_control::arguments::backup())
|
||||
.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"));
|
||||
}
|
||||
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
|
||||
|
|
|
@ -21,8 +21,7 @@ use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code};
|
|||
use uucore::line_ending::LineEnding;
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("join.md");
|
||||
const USAGE: &str = help_usage!("join.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
enum JoinError {
|
||||
|
@ -855,8 +854,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("join-about"))
|
||||
.override_usage(format_usage(&get_message("join-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new("a")
|
||||
|
|
|
@ -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::{format_usage, help_about, help_usage, show};
|
||||
|
||||
static ABOUT: &str = help_about!("kill.md");
|
||||
const USAGE: &str = help_usage!("kill.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
// 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
|
||||
|
@ -104,8 +103,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("kill-about"))
|
||||
.override_usage(format_usage(&get_message("kill-usage")))
|
||||
.infer_long_args(true)
|
||||
.allow_negative_numbers(true)
|
||||
.arg(
|
||||
|
|
|
@ -11,8 +11,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{FromIo, UResult};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
static ABOUT: &str = help_about!("link.md");
|
||||
const USAGE: &str = help_usage!("link.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static FILES: &str = "FILES";
|
||||
|
@ -36,8 +35,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("link-about"))
|
||||
.override_usage(format_usage(&get_message("link-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::FILES)
|
||||
|
|
|
@ -70,9 +70,7 @@ impl UError for LnError {
|
|||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("ln.md");
|
||||
const USAGE: &str = help_usage!("ln.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "ln.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const FORCE: &str = "force";
|
||||
|
@ -93,7 +91,8 @@ static ARG_FILES: &str = "files";
|
|||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let after_help = format!(
|
||||
"{AFTER_HELP}\n\n{}",
|
||||
"{}\n\n{}",
|
||||
get_message("ln-after-help"),
|
||||
backup_control::BACKUP_CONTROL_LONG_HELP
|
||||
);
|
||||
|
||||
|
@ -144,8 +143,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("ln-about"))
|
||||
.override_usage(format_usage(&get_message("ln-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(backup_control::arguments::backup())
|
||||
.arg(backup_control::arguments::backup_no_args())
|
||||
|
|
|
@ -25,8 +25,7 @@ fn get_userlogin() -> Option<String> {
|
|||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("logname.md");
|
||||
const USAGE: &str = help_usage!("logname.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[uucore::main]
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(uucore::util_name())
|
||||
.about(get_message("logname-about"))
|
||||
.infer_long_args(true)
|
||||
}
|
||||
|
|
|
@ -82,9 +82,7 @@ static CONTEXT_HELP_TEXT: &str = "print any security context of each file (not e
|
|||
#[cfg(feature = "selinux")]
|
||||
static CONTEXT_HELP_TEXT: &str = "print any security context of each file";
|
||||
|
||||
const ABOUT: &str = help_about!("ls.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "ls.md");
|
||||
const USAGE: &str = help_usage!("ls.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub mod format {
|
||||
|
@ -1179,8 +1177,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("ls-usage")))
|
||||
.about(get_message("ls-about"))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.args_override_self(true)
|
||||
|
@ -1869,7 +1867,7 @@ pub fn uu_app() -> Command {
|
|||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.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.
|
||||
|
|
|
@ -20,9 +20,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_if_err};
|
|||
|
||||
static DEFAULT_PERM: u32 = 0o777;
|
||||
|
||||
const ABOUT: &str = help_about!("mkdir.md");
|
||||
const USAGE: &str = help_usage!("mkdir.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "mkdir.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const MODE: &str = "mode";
|
||||
|
@ -103,7 +101,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
// Linux-specific options, not implemented
|
||||
// opts.optflag("Z", "context", "set SELinux security context" +
|
||||
// " 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
|
||||
.get_many::<OsString>(options::DIRS)
|
||||
|
@ -133,8 +133,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("mkdir-about"))
|
||||
.override_usage(format_usage(&get_message("mkdir-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::MODE)
|
||||
|
|
|
@ -13,7 +13,7 @@ use uucore::error::{UResult, USimpleError};
|
|||
use uucore::{format_usage, help_about, help_usage, show};
|
||||
|
||||
static USAGE: &str = help_usage!("mkfifo.md");
|
||||
static ABOUT: &str = help_about!("mkfifo.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub static MODE: &str = "mode";
|
||||
|
@ -86,8 +86,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("mkfifo-usage")))
|
||||
.about(get_message("mkfifo-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::MODE)
|
||||
|
|
|
@ -14,9 +14,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{UResult, USimpleError, UUsageError, set_exit_code};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("mknod.md");
|
||||
const USAGE: &str = help_usage!("mknod.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "mknod.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("mknod-usage")))
|
||||
.after_help(get_message("mknod-after-help"))
|
||||
.about(get_message("mknod-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::MODE)
|
||||
|
|
|
@ -25,8 +25,7 @@ use rand::Rng;
|
|||
use tempfile::Builder;
|
||||
use thiserror::Error;
|
||||
|
||||
const ABOUT: &str = help_about!("mktemp.md");
|
||||
const USAGE: &str = help_usage!("mktemp.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX";
|
||||
|
||||
|
@ -347,8 +346,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("mktemp-about"))
|
||||
.override_usage(format_usage(&get_message("mktemp-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_DIRECTORY)
|
||||
|
|
|
@ -26,8 +26,7 @@ use uucore::error::{UResult, USimpleError, UUsageError};
|
|||
use uucore::{display::Quotable, show};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("more.md");
|
||||
const USAGE: &str = help_usage!("more.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
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,
|
||||
|
@ -155,8 +154,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("more-about"))
|
||||
.override_usage(format_usage(&get_message("more-usage")))
|
||||
.version(uucore::crate_version!())
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
|
|
|
@ -123,9 +123,7 @@ pub enum OverwriteMode {
|
|||
Force,
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("mv.md");
|
||||
const USAGE: &str = help_usage!("mv.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "mv.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static OPT_FORCE: &str = "force";
|
||||
static OPT_INTERACTIVE: &str = "interactive";
|
||||
|
@ -205,10 +203,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("mv-about"))
|
||||
.override_usage(format_usage(&get_message("mv-usage")))
|
||||
.after_help(format!(
|
||||
"{AFTER_HELP}\n\n{}",
|
||||
"{}\n\n{}",
|
||||
get_message("mv-after-help"),
|
||||
backup_control::BACKUP_CONTROL_LONG_HELP
|
||||
))
|
||||
.infer_long_args(true)
|
||||
|
|
|
@ -21,8 +21,7 @@ pub mod options {
|
|||
pub static COMMAND: &str = "COMMAND";
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("nice.md");
|
||||
const USAGE: &str = help_usage!("nice.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
fn is_prefix_of(maybe_prefix: &str, target: &str, min_match: usize) -> bool {
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("nice-about"))
|
||||
.override_usage(format_usage(&get_message("nice-usage")))
|
||||
.trailing_var_arg(true)
|
||||
.infer_long_args(true)
|
||||
.version(uucore::crate_version!())
|
||||
|
|
|
@ -12,9 +12,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
|||
|
||||
mod helper;
|
||||
|
||||
const ABOUT: &str = help_about!("nl.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "nl.md");
|
||||
const USAGE: &str = help_usage!("nl.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
// Settings store options used by nl to produce its output.
|
||||
pub struct Settings {
|
||||
|
@ -222,10 +220,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.about(ABOUT)
|
||||
.about(get_message("nl-about"))
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(&get_message("nl-usage")))
|
||||
.after_help(get_message("nl-after-help"))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.arg(
|
||||
|
|
|
@ -19,9 +19,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{UClapError, UError, UResult, set_exit_code};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
||||
|
||||
const ABOUT: &str = help_about!("nohup.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "nohup.md");
|
||||
const USAGE: &str = help_usage!("nohup.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
static NOHUP_OUT: &str = "nohup.out";
|
||||
// exit codes that match the GNU implementation
|
||||
static EXIT_CANCELED: i32 = 125;
|
||||
|
@ -92,9 +90,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("nohup-about"))
|
||||
.after_help(get_message("nohup-after-help"))
|
||||
.override_usage(format_usage(&get_message("nohup-usage")))
|
||||
.arg(
|
||||
Arg::new(options::CMD)
|
||||
.hide(true)
|
||||
|
|
|
@ -23,8 +23,7 @@ pub const _SC_NPROCESSORS_CONF: libc::c_int = 1001;
|
|||
static OPT_ALL: &str = "all";
|
||||
static OPT_IGNORE: &str = "ignore";
|
||||
|
||||
const ABOUT: &str = help_about!("nproc.md");
|
||||
const USAGE: &str = help_usage!("nproc.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[uucore::main]
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("nproc-about"))
|
||||
.override_usage(format_usage(&get_message("nproc-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_ALL)
|
||||
|
|
|
@ -24,9 +24,7 @@ pub mod format;
|
|||
pub mod options;
|
||||
mod units;
|
||||
|
||||
const ABOUT: &str = help_about!("numfmt.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "numfmt.md");
|
||||
const USAGE: &str = help_usage!("numfmt.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
fn handle_args<'a>(args: impl Iterator<Item = &'a str>, options: &NumfmtOptions) -> UResult<()> {
|
||||
for l in args {
|
||||
|
@ -277,9 +275,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("numfmt-about"))
|
||||
.after_help(get_message("numfmt-after-help"))
|
||||
.override_usage(format_usage(&get_message("numfmt-usage")))
|
||||
.allow_negative_numbers(true)
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
|
|
|
@ -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 ABOUT: &str = help_about!("od.md");
|
||||
const USAGE: &str = help_usage!("od.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "od.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub(crate) mod options {
|
||||
pub const HELP: &str = "help";
|
||||
|
@ -253,9 +251,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.about(get_message("od-about"))
|
||||
.override_usage(format_usage(&get_message("od-usage")))
|
||||
.after_help(get_message("od-after-help"))
|
||||
.trailing_var_arg(true)
|
||||
.dont_delimit_trailing_values(true)
|
||||
.infer_long_args(true)
|
||||
|
|
|
@ -14,8 +14,7 @@ use uucore::error::{UResult, USimpleError};
|
|||
use uucore::line_ending::LineEnding;
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("paste.md");
|
||||
const USAGE: &str = help_usage!("paste.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const DELIMITER: &str = "delimiters";
|
||||
|
@ -43,8 +42,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("paste-about"))
|
||||
.override_usage(format_usage(&get_message("paste-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::SERIAL)
|
||||
|
|
|
@ -20,8 +20,7 @@ enum Mode {
|
|||
Both, // a combination of `Basic` and `Extra`
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("pathchk.md");
|
||||
const USAGE: &str = help_usage!("pathchk.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const POSIX: &str = "posix";
|
||||
|
@ -80,8 +79,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("pathchk-about"))
|
||||
.override_usage(format_usage(&get_message("pathchk-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::POSIX)
|
||||
|
|
|
@ -20,9 +20,7 @@ const ABOUT: &str = concat!(
|
|||
);
|
||||
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
const ABOUT: &str = help_about!("pinky.md");
|
||||
|
||||
const USAGE: &str = help_usage!("pinky.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const LONG_FORMAT: &str = "long_format";
|
||||
|
@ -44,8 +42,8 @@ use platform::uumain;
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("pinky-about"))
|
||||
.override_usage(format_usage(&get_message("pinky-usage")))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.arg(
|
||||
|
|
|
@ -20,9 +20,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::UResult;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("pr.md");
|
||||
const USAGE: &str = help_usage!("pr.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "pr.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const TAB: char = '\t';
|
||||
const LINES_PER_PAGE: usize = 66;
|
||||
const LINES_PER_PAGE_FOR_FORM_FEED: usize = 63;
|
||||
|
@ -153,9 +151,9 @@ enum PrError {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("pr-about"))
|
||||
.after_help(get_message("pr-after-help"))
|
||||
.override_usage(format_usage(&get_message("pr-usage")))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.disable_help_flag(true)
|
||||
|
|
|
@ -7,8 +7,7 @@ use clap::{Arg, ArgAction, Command};
|
|||
use std::env;
|
||||
use uucore::{error::UResult, format_usage, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("printenv.md");
|
||||
const USAGE: &str = help_usage!("printenv.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static OPT_NULL: &str = "null";
|
||||
|
||||
|
@ -56,8 +55,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("printenv-about"))
|
||||
.override_usage(format_usage(&get_message("printenv-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_NULL)
|
||||
|
|
|
@ -11,9 +11,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, os_str_as_bytes
|
|||
|
||||
const VERSION: &str = "version";
|
||||
const HELP: &str = "help";
|
||||
const USAGE: &str = help_usage!("printf.md");
|
||||
const ABOUT: &str = help_about!("printf.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "printf.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const FORMAT: &str = "FORMAT";
|
||||
|
@ -81,9 +79,9 @@ pub fn uu_app() -> Command {
|
|||
Command::new(uucore::util_name())
|
||||
.allow_hyphen_values(true)
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("printf-about"))
|
||||
.after_help(get_message("printf-after-help"))
|
||||
.override_usage(format_usage(&get_message("printf-usage")))
|
||||
.disable_help_flag(true)
|
||||
.disable_version_flag(true)
|
||||
.arg(
|
||||
|
|
|
@ -19,8 +19,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{FromIo, UError, UResult, UUsageError};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
const USAGE: &str = help_usage!("ptx.md");
|
||||
const ABOUT: &str = help_about!("ptx.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[derive(Debug)]
|
||||
enum OutFormat {
|
||||
|
@ -765,9 +764,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.about(ABOUT)
|
||||
.about(get_message("ptx-about"))
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.override_usage(format_usage(&get_message("ptx-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
|
|
|
@ -13,8 +13,7 @@ use uucore::{format_usage, help_about, help_usage};
|
|||
use uucore::display::println_verbatim;
|
||||
use uucore::error::{FromIo, UResult};
|
||||
|
||||
const ABOUT: &str = help_about!("pwd.md");
|
||||
const USAGE: &str = help_usage!("pwd.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const OPT_LOGICAL: &str = "logical";
|
||||
const OPT_PHYSICAL: &str = "physical";
|
||||
|
||||
|
@ -141,8 +140,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("pwd-about"))
|
||||
.override_usage(format_usage(&get_message("pwd-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_LOGICAL)
|
||||
|
|
|
@ -15,8 +15,7 @@ use uucore::fs::{MissingHandling, ResolveMode, canonicalize};
|
|||
use uucore::line_ending::LineEnding;
|
||||
use uucore::{format_usage, help_about, help_usage, show_error};
|
||||
|
||||
const ABOUT: &str = help_about!("readlink.md");
|
||||
const USAGE: &str = help_usage!("readlink.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const OPT_CANONICALIZE: &str = "canonicalize";
|
||||
const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
|
||||
const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
|
||||
|
@ -102,8 +101,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("readlink-about"))
|
||||
.override_usage(format_usage(&get_message("readlink-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_CANONICALIZE)
|
||||
|
|
|
@ -21,8 +21,7 @@ use uucore::{
|
|||
show_if_err,
|
||||
};
|
||||
|
||||
static ABOUT: &str = help_about!("realpath.md");
|
||||
const USAGE: &str = help_usage!("realpath.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static OPT_QUIET: &str = "quiet";
|
||||
static OPT_STRIP: &str = "strip";
|
||||
|
@ -89,8 +88,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("realpath-about"))
|
||||
.override_usage(format_usage(&get_message("realpath-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_QUIET)
|
||||
|
|
|
@ -90,9 +90,7 @@ impl Default for Options {
|
|||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("rm.md");
|
||||
const USAGE: &str = help_usage!("rm.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "rm.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
static OPT_DIR: &str = "dir";
|
||||
static OPT_INTERACTIVE: &str = "interactive";
|
||||
|
@ -202,9 +200,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.about(get_message("rm-about"))
|
||||
.override_usage(format_usage(&get_message("rm-usage")))
|
||||
.after_help(get_message("rm-after-help"))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
|
|
@ -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};
|
||||
|
||||
static ABOUT: &str = help_about!("rmdir.md");
|
||||
const USAGE: &str = help_usage!("rmdir.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
static OPT_IGNORE_FAIL_NON_EMPTY: &str = "ignore-fail-on-non-empty";
|
||||
static OPT_PARENTS: &str = "parents";
|
||||
static OPT_VERBOSE: &str = "verbose";
|
||||
|
@ -165,8 +164,8 @@ struct Opts {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("rmdir-about"))
|
||||
.override_usage(format_usage(&get_message("rmdir-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_IGNORE_FAIL_NON_EMPTY)
|
||||
|
|
|
@ -23,8 +23,7 @@ mod errors;
|
|||
use errors::error_exit_status;
|
||||
use errors::{Error, Result, RunconError};
|
||||
|
||||
const ABOUT: &str = help_about!("runcon.md");
|
||||
const USAGE: &str = help_usage!("runcon.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const DESCRIPTION: &str = help_section!("after help", "runcon.md");
|
||||
|
||||
pub mod options {
|
||||
|
@ -90,9 +89,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.about(get_message("runcon-about"))
|
||||
.after_help(DESCRIPTION)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.override_usage(format_usage(&get_message("runcon-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::COMPUTE)
|
||||
|
|
|
@ -28,8 +28,7 @@ mod numberparse;
|
|||
use crate::error::SeqError;
|
||||
use crate::number::PreciseNumber;
|
||||
|
||||
const ABOUT: &str = help_about!("seq.md");
|
||||
const USAGE: &str = help_usage!("seq.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
const OPT_SEPARATOR: &str = "separator";
|
||||
const OPT_TERMINATOR: &str = "terminator";
|
||||
|
@ -222,8 +221,8 @@ pub fn uu_app() -> Command {
|
|||
.trailing_var_arg(true)
|
||||
.infer_long_args(true)
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("seq-about"))
|
||||
.override_usage(format_usage(&get_message("seq-usage")))
|
||||
.arg(
|
||||
Arg::new(OPT_SEPARATOR)
|
||||
.short('s')
|
||||
|
|
|
@ -20,9 +20,7 @@ use uucore::parser::parse_size::parse_size_u64;
|
|||
use uucore::parser::shortcut_value_parser::ShortcutValueParser;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show_error, show_if_err};
|
||||
|
||||
const ABOUT: &str = help_about!("shred.md");
|
||||
const USAGE: &str = help_usage!("shred.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "shred.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub const FORCE: &str = "force";
|
||||
|
@ -316,9 +314,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("shred-about"))
|
||||
.after_help(get_message("shred-after-help"))
|
||||
.override_usage(format_usage(&get_message("shred-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::FORCE)
|
||||
|
|
|
@ -30,7 +30,7 @@ enum Mode {
|
|||
}
|
||||
|
||||
static USAGE: &str = help_usage!("shuf.md");
|
||||
static ABOUT: &str = help_about!("shuf.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
struct Options {
|
||||
head_count: usize,
|
||||
|
@ -143,9 +143,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.about(ABOUT)
|
||||
.about(get_message("shuf-about"))
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.override_usage(format_usage(&get_message("shuf-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::ECHO)
|
||||
|
|
|
@ -15,8 +15,7 @@ use uucore::{
|
|||
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
|
||||
static ABOUT: &str = help_about!("sleep.md");
|
||||
const USAGE: &str = help_usage!("sleep.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
static AFTER_HELP: &str = help_section!("after help", "sleep.md");
|
||||
|
||||
mod options {
|
||||
|
@ -47,9 +46,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("sleep-about"))
|
||||
.after_help(get_message("sleep-after-help"))
|
||||
.override_usage(format_usage(&get_message("sleep-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::NUMBER)
|
||||
|
|
|
@ -52,9 +52,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
|||
|
||||
use crate::tmp_dir::TmpDirWrapper;
|
||||
|
||||
const ABOUT: &str = help_about!("sort.md");
|
||||
const USAGE: &str = help_usage!("sort.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "sort.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub mod modes {
|
||||
|
@ -1340,9 +1338,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("sort-about"))
|
||||
.after_help(get_message("sort-after-help"))
|
||||
.override_usage(format_usage(&get_message("sort-usage")))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.disable_version_flag(true)
|
||||
|
|
|
@ -46,9 +46,7 @@ static OPT_IO_BLKSIZE: &str = "-io-blksize";
|
|||
static ARG_INPUT: &str = "input";
|
||||
static ARG_PREFIX: &str = "prefix";
|
||||
|
||||
const ABOUT: &str = help_about!("split.md");
|
||||
const USAGE: &str = help_usage!("split.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "split.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
|
@ -229,9 +227,9 @@ fn handle_preceding_options(
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(AFTER_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("split-about"))
|
||||
.after_help(get_message("split-after-help"))
|
||||
.override_usage(format_usage(&get_message("split-usage")))
|
||||
.infer_long_args(true)
|
||||
// strategy (mutually exclusive)
|
||||
.arg(
|
||||
|
|
|
@ -28,8 +28,7 @@ use std::os::unix::prelude::OsStrExt;
|
|||
use std::path::Path;
|
||||
use std::{env, fs};
|
||||
|
||||
const ABOUT: &str = help_about!("stat.md");
|
||||
const USAGE: &str = help_usage!("stat.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const LONG_USAGE: &str = help_section!("long usage", "stat.md");
|
||||
|
||||
mod options {
|
||||
|
@ -1149,8 +1148,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("stat-about"))
|
||||
.override_usage(format_usage(&get_message("stat-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::DEREFERENCE)
|
||||
|
|
|
@ -14,11 +14,11 @@ use std::process;
|
|||
use tempfile::TempDir;
|
||||
use tempfile::tempdir;
|
||||
use uucore::error::{FromIo, UClapError, UResult, USimpleError, UUsageError};
|
||||
use uucore::format_usage;
|
||||
use uucore::parser::parse_size::parse_size_u64;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("stdbuf.md");
|
||||
const USAGE: &str = help_usage!("stdbuf.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
const LONG_HELP: &str = help_section!("after help", "stdbuf.md");
|
||||
|
||||
mod options {
|
||||
|
@ -204,9 +204,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(LONG_HELP)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("stdbuf-about"))
|
||||
.after_help(get_message("stdbuf-after-help"))
|
||||
.override_usage(format_usage(&get_message("stdbuf-usage")))
|
||||
.trailing_var_arg(true)
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
|
|
|
@ -21,6 +21,7 @@ use std::os::fd::{AsFd, BorrowedFd};
|
|||
use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use uucore::error::{UResult, USimpleError};
|
||||
use uucore::locale::get_message;
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
#[cfg(not(any(
|
||||
|
@ -34,9 +35,6 @@ use uucore::{format_usage, help_about, help_usage};
|
|||
use flags::BAUD_RATES;
|
||||
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)]
|
||||
pub struct Flag<T> {
|
||||
name: &'static str,
|
||||
|
@ -476,8 +474,8 @@ fn apply_baud_rate_flag(termios: &mut Termios, input: &str) -> ControlFlow<bool>
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(SUMMARY)
|
||||
.override_usage(format_usage(&get_message("stty-usage")))
|
||||
.about(get_message("stty-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::ALL)
|
||||
|
|
|
@ -13,8 +13,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::{format_usage, help_about, help_usage, show};
|
||||
|
||||
const USAGE: &str = help_usage!("sum.md");
|
||||
const ABOUT: &str = help_about!("sum.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
fn bsd_sum(mut reader: impl Read) -> std::io::Result<(usize, u16)> {
|
||||
let mut buf = [0; 4096];
|
||||
|
@ -138,8 +137,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("sum-usage")))
|
||||
.about(get_message("sum-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
|
|
|
@ -19,8 +19,7 @@ use uucore::error::FromIo;
|
|||
use uucore::error::{UResult, USimpleError};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("sync.md");
|
||||
const USAGE: &str = help_usage!("sync.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static FILE_SYSTEM: &str = "file-system";
|
||||
|
@ -222,8 +221,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("sync-about"))
|
||||
.override_usage(format_usage(&get_message("sync-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::FILE_SYSTEM)
|
||||
|
|
|
@ -22,7 +22,7 @@ use uucore::{format_usage, help_about, help_usage, show};
|
|||
use crate::error::TacError;
|
||||
|
||||
static USAGE: &str = help_usage!("tac.md");
|
||||
static ABOUT: &str = help_about!("tac.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub static BEFORE: &str = "before";
|
||||
|
@ -58,8 +58,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("tac-usage")))
|
||||
.about(get_message("tac-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::BEFORE)
|
||||
|
|
|
@ -18,8 +18,7 @@ use uucore::parser::parse_time;
|
|||
use uucore::parser::shortcut_value_parser::ShortcutValueParser;
|
||||
use uucore::{format_usage, help_about, help_usage, show_warning};
|
||||
|
||||
const ABOUT: &str = help_about!("tail.md");
|
||||
const USAGE: &str = help_usage!("tail.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub mod verbosity {
|
||||
|
@ -464,8 +463,8 @@ pub fn uu_app() -> Command {
|
|||
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("tail-about"))
|
||||
.override_usage(format_usage(&get_message("tail-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::BYTES)
|
||||
|
|
|
@ -19,9 +19,7 @@ use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
|||
#[cfg(unix)]
|
||||
use uucore::signals::{enable_pipe_errors, ignore_interrupts};
|
||||
|
||||
const ABOUT: &str = help_about!("tee.md");
|
||||
const USAGE: &str = help_usage!("tee.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "tee.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const APPEND: &str = "append";
|
||||
|
@ -97,9 +95,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.about(get_message("tee-about"))
|
||||
.override_usage(format_usage(&get_message("tee-usage")))
|
||||
.after_help(get_message("tee-after-help"))
|
||||
.infer_long_args(true)
|
||||
// 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.
|
||||
|
|
|
@ -21,31 +21,23 @@ use uucore::error::{UResult, USimpleError};
|
|||
use uucore::process::{getegid, geteuid};
|
||||
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 {}.
|
||||
// And, The format_usage method replaces {} with execution_phrase ( e.g. test or [ ).
|
||||
// However, This test command has two util names.
|
||||
// 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)
|
||||
const AFTER_HELP: &str = help_section!("after help", "test.md");
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
// 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.
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.after_help(AFTER_HELP)
|
||||
.about(get_message("test-about"))
|
||||
.override_usage(format_usage(&get_message("test-usage")))
|
||||
.after_help(get_message("test-after-help"))
|
||||
}
|
||||
|
||||
#[uucore::main]
|
||||
|
|
|
@ -25,8 +25,7 @@ use uucore::{
|
|||
signals::{signal_by_name_or_value, signal_name_by_value},
|
||||
};
|
||||
|
||||
const ABOUT: &str = help_about!("timeout.md");
|
||||
const USAGE: &str = help_usage!("timeout.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static FOREGROUND: &str = "foreground";
|
||||
|
@ -122,8 +121,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new("timeout")
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("timeout-about"))
|
||||
.override_usage(format_usage(&get_message("timeout-usage")))
|
||||
.arg(
|
||||
Arg::new(options::FOREGROUND)
|
||||
.long(options::FOREGROUND)
|
||||
|
|
|
@ -83,8 +83,7 @@ pub enum Source {
|
|||
Now,
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("touch.md");
|
||||
const USAGE: &str = help_usage!("touch.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
// 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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("touch-about"))
|
||||
.override_usage(format_usage(&get_message("touch-usage")))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.arg(
|
||||
|
|
|
@ -20,9 +20,7 @@ use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
|
|||
use uucore::fs::is_stdin_directory;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, os_str_as_bytes, show};
|
||||
|
||||
const ABOUT: &str = help_about!("tr.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "tr.md");
|
||||
const USAGE: &str = help_usage!("tr.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const COMPLEMENT: &str = "complement";
|
||||
|
@ -34,7 +32,9 @@ mod options {
|
|||
|
||||
#[uucore::main]
|
||||
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 complement_flag = matches.get_flag(options::COMPLEMENT);
|
||||
|
@ -164,8 +164,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("tr-about"))
|
||||
.override_usage(format_usage(&get_message("tr-usage")))
|
||||
.infer_long_args(true)
|
||||
.trailing_var_arg(true)
|
||||
.arg(
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::{ffi::OsString, io::Write};
|
|||
use uucore::error::{UResult, set_exit_code};
|
||||
use uucore::help_about;
|
||||
|
||||
const ABOUT: &str = help_about!("true.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[uucore::main]
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.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.
|
||||
.disable_help_flag(true)
|
||||
.disable_version_flag(true)
|
||||
|
|
|
@ -71,9 +71,7 @@ impl TruncateMode {
|
|||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("truncate.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "truncate.md");
|
||||
const USAGE: &str = help_usage!("truncate.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static IO_BLOCKS: &str = "io-blocks";
|
||||
|
@ -86,7 +84,7 @@ pub mod options {
|
|||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let matches = uu_app()
|
||||
.after_help(AFTER_HELP)
|
||||
.after_help(get_message("truncate-after-help"))
|
||||
.try_get_matches_from(args)
|
||||
.map_err(|e| {
|
||||
e.print().expect("Error writing clap::Error");
|
||||
|
@ -117,8 +115,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("truncate-about"))
|
||||
.override_usage(format_usage(&get_message("truncate-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::IO_BLOCKS)
|
||||
|
|
|
@ -11,8 +11,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{UError, UResult};
|
||||
use uucore::{format_usage, help_about, help_usage, show};
|
||||
|
||||
const ABOUT: &str = help_about!("tsort.md");
|
||||
const USAGE: &str = help_usage!("tsort.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const FILE: &str = "file";
|
||||
|
@ -76,8 +75,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("tsort-usage")))
|
||||
.about(get_message("tsort-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
|
|
|
@ -12,8 +12,7 @@ use std::io::{IsTerminal, Write};
|
|||
use uucore::error::{UResult, set_exit_code};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("tty.md");
|
||||
const USAGE: &str = help_usage!("tty.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub const SILENT: &str = "silent";
|
||||
|
@ -58,8 +57,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("tty-about"))
|
||||
.override_usage(format_usage(&get_message("tty-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::SILENT)
|
||||
|
|
|
@ -12,8 +12,7 @@ use uucore::{
|
|||
format_usage, help_about, help_usage,
|
||||
};
|
||||
|
||||
const ABOUT: &str = help_about!("uname.md");
|
||||
const USAGE: &str = help_usage!("uname.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static ALL: &str = "all";
|
||||
|
@ -146,8 +145,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("uname-about"))
|
||||
.override_usage(format_usage(&get_message("uname-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::ALL)
|
||||
|
|
|
@ -17,8 +17,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{FromIo, UError, UResult, USimpleError};
|
||||
use uucore::{format_usage, help_about, help_usage, show};
|
||||
|
||||
const USAGE: &str = help_usage!("unexpand.md");
|
||||
const ABOUT: &str = help_about!("unexpand.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
const DEFAULT_TABSTOP: usize = 8;
|
||||
|
||||
|
@ -157,8 +156,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(&get_message("unexpand-usage")))
|
||||
.about(get_message("unexpand-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
|
|
|
@ -17,9 +17,7 @@ use uucore::parser::shortcut_value_parser::ShortcutValueParser;
|
|||
use uucore::posix::{OBSOLETE, posix_version};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("uniq.md");
|
||||
const USAGE: &str = help_usage!("uniq.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "uniq.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static ALL_REPEATED: &str = "all-repeated";
|
||||
|
@ -593,10 +591,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("uniq-about"))
|
||||
.override_usage(format_usage(&get_message("uniq-usage")))
|
||||
.infer_long_args(true)
|
||||
.after_help(AFTER_HELP)
|
||||
.after_help(get_message("uniq-after-help"))
|
||||
.arg(
|
||||
Arg::new(options::ALL_REPEATED)
|
||||
.short('D')
|
||||
|
|
|
@ -14,8 +14,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{FromIo, UResult};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("unlink.md");
|
||||
const USAGE: &str = help_usage!("unlink.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
static OPT_PATH: &str = "FILE";
|
||||
|
||||
#[uucore::main]
|
||||
|
@ -30,8 +29,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("unlink-about"))
|
||||
.override_usage(format_usage(&get_message("unlink-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(OPT_PATH)
|
||||
|
|
|
@ -31,9 +31,7 @@ const ABOUT: &str = concat!(
|
|||
);
|
||||
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
const ABOUT: &str = help_about!("uptime.md");
|
||||
|
||||
const USAGE: &str = help_usage!("uptime.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
pub mod options {
|
||||
pub static SINCE: &str = "since";
|
||||
|
@ -78,8 +76,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
let cmd = Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("uptime-about"))
|
||||
.override_usage(format_usage(&get_message("uptime-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::SINCE)
|
||||
|
|
|
@ -26,9 +26,7 @@ const ABOUT: &str = concat!(
|
|||
);
|
||||
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
const ABOUT: &str = help_about!("users.md");
|
||||
|
||||
const USAGE: &str = help_usage!("users.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
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 {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("users-about"))
|
||||
.override_usage(format_usage(&get_message("users-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(ARG_FILE)
|
||||
|
|
|
@ -113,8 +113,7 @@ impl<'a> Settings<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = help_about!("wc.md");
|
||||
const USAGE: &str = help_usage!("wc.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
mod options {
|
||||
pub static BYTES: &str = "bytes";
|
||||
|
@ -397,8 +396,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("wc-about"))
|
||||
.override_usage(format_usage(&get_message("wc-usage")))
|
||||
.infer_long_args(true)
|
||||
.args_override_self(true)
|
||||
.arg(
|
||||
|
|
|
@ -37,9 +37,7 @@ const ABOUT: &str = concat!(
|
|||
);
|
||||
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
const ABOUT: &str = help_about!("who.md");
|
||||
|
||||
const USAGE: &str = help_usage!("who.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
static RUNLEVEL_HELP: &str = "print current runlevel";
|
||||
|
@ -52,8 +50,8 @@ use platform::uumain;
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("who-about"))
|
||||
.override_usage(format_usage(&get_message("who-usage")))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::ALL)
|
||||
|
|
|
@ -13,8 +13,7 @@ use uucore::{format_usage, help_about, help_usage};
|
|||
|
||||
mod platform;
|
||||
|
||||
const ABOUT: &str = help_about!("whoami.md");
|
||||
const USAGE: &str = help_usage!("whoami.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
|
@ -32,7 +31,7 @@ pub fn whoami() -> UResult<OsString> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("whoami-about"))
|
||||
.override_usage(uucore::util_name())
|
||||
.infer_long_args(true)
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@ use uucore::error::{UResult, USimpleError};
|
|||
use uucore::signals::enable_pipe_errors;
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
const ABOUT: &str = help_about!("yes.md");
|
||||
const USAGE: &str = help_usage!("yes.md");
|
||||
use uucore::locale::{self, get_message};
|
||||
|
||||
// it's possible that using a smaller or larger buffer might provide better performance on some
|
||||
// systems, but honestly this is good enough
|
||||
|
@ -39,8 +38,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.about(get_message("yes-about"))
|
||||
.override_usage(format_usage(&get_message("yes-usage")))
|
||||
.arg(
|
||||
Arg::new("STRING")
|
||||
.value_parser(ValueParser::os_string())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue