mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #8054 from sylvestre/locale3
l10n: convert the md files to fluent
This commit is contained in:
commit
ccc6233fba
309 changed files with 2049 additions and 2711 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3601,6 +3601,7 @@ dependencies = [
|
|||
"dunce",
|
||||
"fluent",
|
||||
"fluent-bundle",
|
||||
"fluent-syntax",
|
||||
"glob",
|
||||
"hex",
|
||||
"itertools 0.14.0",
|
||||
|
|
|
@ -364,6 +364,7 @@ digest = "0.10.7"
|
|||
fluent-bundle = "0.16.0"
|
||||
fluent = "0.17.0"
|
||||
unic-langid = "0.9.6"
|
||||
fluent-syntax = "0.12.0"
|
||||
|
||||
uucore = { version = "0.1.0", package = "uucore", path = "src/uucore" }
|
||||
uucore_procs = { version = "0.1.0", package = "uucore_procs", path = "src/uucore_procs" }
|
||||
|
|
1
fuzz/Cargo.lock
generated
1
fuzz/Cargo.lock
generated
|
@ -1418,6 +1418,7 @@ dependencies = [
|
|||
"dunce",
|
||||
"fluent",
|
||||
"fluent-bundle",
|
||||
"fluent-syntax",
|
||||
"glob",
|
||||
"hex",
|
||||
"itertools",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore manpages mangen
|
||||
// spell-checker:ignore manpages mangen prefixcat testcat
|
||||
|
||||
use clap::{Arg, Command};
|
||||
use clap_complete::Shell;
|
||||
|
@ -14,6 +14,7 @@ use std::io::{self, Write};
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::process;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::locale;
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
|
@ -50,6 +51,48 @@ fn name(binary_path: &Path) -> Option<&str> {
|
|||
binary_path.file_stem()?.to_str()
|
||||
}
|
||||
|
||||
fn get_canonical_util_name(util_name: &str) -> &str {
|
||||
match util_name {
|
||||
// uu_test aliases - '[' is an alias for test
|
||||
"[" => "test",
|
||||
|
||||
// hashsum aliases - all these hash commands are aliases for hashsum
|
||||
"md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum"
|
||||
| "sha3sum" | "sha3-224sum" | "sha3-256sum" | "sha3-384sum" | "sha3-512sum"
|
||||
| "shake128sum" | "shake256sum" | "b2sum" | "b3sum" => "hashsum",
|
||||
|
||||
"dir" => "ls", // dir is an alias for ls
|
||||
|
||||
// Default case - return the util name as is
|
||||
_ => util_name,
|
||||
}
|
||||
}
|
||||
|
||||
fn find_prefixed_util<'a>(
|
||||
binary_name: &str,
|
||||
mut util_keys: impl Iterator<Item = &'a str>,
|
||||
) -> Option<&'a str> {
|
||||
util_keys.find(|util| {
|
||||
binary_name.ends_with(*util)
|
||||
&& binary_name.len() > util.len() // Ensure there's actually a prefix
|
||||
&& !binary_name[..binary_name.len() - (*util).len()]
|
||||
.ends_with(char::is_alphanumeric)
|
||||
})
|
||||
}
|
||||
|
||||
fn setup_localization_or_exit(util_name: &str) {
|
||||
locale::setup_localization(get_canonical_util_name(util_name)).unwrap_or_else(|err| {
|
||||
match err {
|
||||
uucore::locale::LocalizationError::ParseResource {
|
||||
error: err_msg,
|
||||
snippet,
|
||||
} => eprintln!("Localization parse error at {snippet}: {err_msg}"),
|
||||
other => eprintln!("Could not init the localization system: {other}"),
|
||||
}
|
||||
process::exit(99)
|
||||
});
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn main() {
|
||||
uucore::panic::mute_sigpipe_panic();
|
||||
|
@ -70,13 +113,10 @@ fn main() {
|
|||
|
||||
// binary name equals prefixed util name?
|
||||
// * prefix/stem may be any string ending in a non-alphanumeric character
|
||||
let util_name = if let Some(util) = utils.keys().find(|util| {
|
||||
binary_as_util.ends_with(*util)
|
||||
&& !binary_as_util[..binary_as_util.len() - (*util).len()]
|
||||
.ends_with(char::is_alphanumeric)
|
||||
}) {
|
||||
// For example, if the binary is named `uu_test`, it will match `test` as a utility.
|
||||
let util_name = if let Some(util) = find_prefixed_util(binary_as_util, utils.keys().copied()) {
|
||||
// prefixed util => replace 0th (aka, executable name) argument
|
||||
Some(OsString::from(*util))
|
||||
Some(OsString::from(util))
|
||||
} else {
|
||||
// unmatched binary name => regard as multi-binary container and advance argument list
|
||||
uucore::set_utility_is_second_arg();
|
||||
|
@ -111,6 +151,12 @@ fn main() {
|
|||
|
||||
match utils.get(util) {
|
||||
Some(&(uumain, _)) => {
|
||||
// TODO: plug the deactivation of the translation
|
||||
// and load the English strings directly at compilation time in the
|
||||
// binary to avoid the load of the flt
|
||||
// Could be something like:
|
||||
// #[cfg(not(feature = "only_english"))]
|
||||
setup_localization_or_exit(util);
|
||||
process::exit(uumain(vec![util_os].into_iter().chain(args)));
|
||||
}
|
||||
None => {
|
||||
|
@ -213,6 +259,7 @@ fn gen_manpage<T: uucore::Args>(
|
|||
let command = if utility == "coreutils" {
|
||||
gen_coreutils_app(util_map)
|
||||
} else {
|
||||
setup_localization_or_exit(utility);
|
||||
util_map.get(utility).unwrap().1()
|
||||
};
|
||||
|
||||
|
@ -239,3 +286,70 @@ fn gen_coreutils_app<T: uucore::Args>(util_map: &UtilityMap<T>) -> Command {
|
|||
}
|
||||
command
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn test_get_canonical_util_name() {
|
||||
// Test a few key aliases
|
||||
assert_eq!(get_canonical_util_name("["), "test");
|
||||
assert_eq!(get_canonical_util_name("md5sum"), "hashsum");
|
||||
assert_eq!(get_canonical_util_name("dir"), "ls");
|
||||
|
||||
// Test passthrough case
|
||||
assert_eq!(get_canonical_util_name("cat"), "cat");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_name() {
|
||||
// Test normal executable name
|
||||
assert_eq!(name(Path::new("/usr/bin/ls")), Some("ls"));
|
||||
assert_eq!(name(Path::new("cat")), Some("cat"));
|
||||
assert_eq!(
|
||||
name(Path::new("./target/debug/coreutils")),
|
||||
Some("coreutils")
|
||||
);
|
||||
|
||||
// Test with extensions
|
||||
assert_eq!(name(Path::new("program.exe")), Some("program"));
|
||||
assert_eq!(name(Path::new("/path/to/utility.bin")), Some("utility"));
|
||||
|
||||
// Test edge cases
|
||||
assert_eq!(name(Path::new("")), None);
|
||||
assert_eq!(name(Path::new("/")), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_find_prefixed_util() {
|
||||
let utils = ["test", "cat", "ls", "cp"];
|
||||
|
||||
// Test exact prefixed matches
|
||||
assert_eq!(
|
||||
find_prefixed_util("uu_test", utils.iter().copied()),
|
||||
Some("test")
|
||||
);
|
||||
assert_eq!(
|
||||
find_prefixed_util("my-cat", utils.iter().copied()),
|
||||
Some("cat")
|
||||
);
|
||||
assert_eq!(
|
||||
find_prefixed_util("prefix_ls", utils.iter().copied()),
|
||||
Some("ls")
|
||||
);
|
||||
|
||||
// Test non-alphanumeric separator requirement
|
||||
assert_eq!(find_prefixed_util("prefixcat", utils.iter().copied()), None); // no separator
|
||||
assert_eq!(find_prefixed_util("testcat", utils.iter().copied()), None); // no separator
|
||||
|
||||
// Test no match
|
||||
assert_eq!(find_prefixed_util("unknown", utils.iter().copied()), None);
|
||||
assert_eq!(find_prefixed_util("", utils.iter().copied()), None);
|
||||
|
||||
// Test exact util name (should not match as prefixed)
|
||||
assert_eq!(find_prefixed_util("test", utils.iter().copied()), None);
|
||||
assert_eq!(find_prefixed_util("cat", utils.iter().copied()), None);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,11 +7,10 @@ use platform_info::*;
|
|||
|
||||
use clap::Command;
|
||||
use uucore::error::{UResult, USimpleError};
|
||||
use uucore::locale::{self, get_message};
|
||||
use uucore::locale::get_message;
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
locale::setup_localization(uucore::util_name())?;
|
||||
uu_app().try_get_matches_from(args)?;
|
||||
|
||||
let uts =
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
# base32
|
||||
|
||||
```
|
||||
base32 [OPTION]... [FILE]
|
||||
```
|
||||
|
||||
encode/decode data and print to standard output
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
|
||||
The data are encoded as described for the base32 alphabet in RFC 4648.
|
||||
When decoding, the input may contain newlines in addition
|
||||
to the bytes of the formal base32 alphabet. Use --ignore-garbage
|
||||
to attempt to recover from any other non-alphabet bytes in the
|
||||
encoded stream.
|
9
src/uu/base32/locales/en-US.ftl
Normal file
9
src/uu/base32/locales/en-US.ftl
Normal file
|
@ -0,0 +1,9 @@
|
|||
base32-about = encode/decode data and print to standard output
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
|
||||
The data are encoded as described for the base32 alphabet in RFC 4648.
|
||||
When decoding, the input may contain newlines in addition
|
||||
to the bytes of the formal base32 alphabet. Use --ignore-garbage
|
||||
to attempt to recover from any other non-alphabet bytes in the
|
||||
encoded stream.
|
||||
base32-usage = base32 [OPTION]... [FILE]
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
# base64
|
||||
|
||||
```
|
||||
base64 [OPTION]... [FILE]
|
||||
```
|
||||
|
||||
encode/decode data and print to standard output
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
|
||||
The data are encoded as described for the base64 alphabet in RFC 3548.
|
||||
When decoding, the input may contain newlines in addition
|
||||
to the bytes of the formal base64 alphabet. Use --ignore-garbage
|
||||
to attempt to recover from any other non-alphabet bytes in the
|
||||
encoded stream.
|
9
src/uu/base64/locales/en-US.ftl
Normal file
9
src/uu/base64/locales/en-US.ftl
Normal file
|
@ -0,0 +1,9 @@
|
|||
base64-about = encode/decode data and print to standard output
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
|
||||
The data are encoded as described for the base64 alphabet in RFC 3548.
|
||||
When decoding, the input may contain newlines in addition
|
||||
to the bytes of the formal base64 alphabet. Use --ignore-garbage
|
||||
to attempt to recover from any other non-alphabet bytes in the
|
||||
encoded stream.
|
||||
base64-usage = base64 [OPTION]... [FILE]
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# basename
|
||||
|
||||
```
|
||||
basename [-z] NAME [SUFFIX]
|
||||
basename OPTION... NAME...
|
||||
```
|
||||
|
||||
Print NAME with any leading directory components removed
|
||||
If specified, also remove a trailing SUFFIX
|
4
src/uu/basename/locales/en-US.ftl
Normal file
4
src/uu/basename/locales/en-US.ftl
Normal file
|
@ -0,0 +1,4 @@
|
|||
basename-about = Print NAME with any leading directory components removed
|
||||
If specified, also remove a trailing SUFFIX
|
||||
basename-usage = basename [-z] NAME [SUFFIX]
|
||||
basename OPTION... NAME...
|
|
@ -9,12 +9,10 @@ use clap::{Arg, ArgAction, Command};
|
|||
use std::path::{PathBuf, is_separator};
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{UResult, UUsageError};
|
||||
use uucore::format_usage;
|
||||
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::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)
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# basenc
|
||||
|
||||
```
|
||||
basenc [OPTION]... [FILE]
|
||||
```
|
||||
|
||||
Encode/decode data and print to standard output
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
|
||||
When decoding, the input may contain newlines in addition to the bytes of
|
||||
the formal alphabet. Use --ignore-garbage to attempt to recover
|
||||
from any other non-alphabet bytes in the encoded stream.
|
7
src/uu/basenc/locales/en-US.ftl
Normal file
7
src/uu/basenc/locales/en-US.ftl
Normal file
|
@ -0,0 +1,7 @@
|
|||
basenc-about = Encode/decode data and print to standard output
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
|
||||
When decoding, the input may contain newlines in addition to the bytes of
|
||||
the formal alphabet. Use --ignore-garbage to attempt to recover
|
||||
from any other non-alphabet bytes in the encoded stream.
|
||||
basenc-usage = basenc [OPTION]... [FILE]
|
|
@ -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)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# cat
|
||||
|
||||
```
|
||||
cat [OPTION]... [FILE]...
|
||||
```
|
||||
|
||||
Concatenate FILE(s), or standard input, to standard output
|
||||
With no FILE, or when FILE is -, read standard input.
|
3
src/uu/cat/locales/en-US.ftl
Normal file
3
src/uu/cat/locales/en-US.ftl
Normal file
|
@ -0,0 +1,3 @@
|
|||
cat-about = Concatenate FILE(s), or standard input, to standard output
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
cat-usage = cat [OPTION]... [FILE]...
|
|
@ -24,15 +24,13 @@ use thiserror::Error;
|
|||
use uucore::display::Quotable;
|
||||
use uucore::error::UResult;
|
||||
use uucore::fs::FileInformation;
|
||||
use uucore::{fast_inc::fast_inc_one, format_usage, help_about, help_usage};
|
||||
use uucore::locale::get_message;
|
||||
use uucore::{fast_inc::fast_inc_one, format_usage};
|
||||
|
||||
/// Linux splice support
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
mod splice;
|
||||
|
||||
const USAGE: &str = help_usage!("cat.md");
|
||||
const ABOUT: &str = help_about!("cat.md");
|
||||
|
||||
// Allocate 32 digits for the line number.
|
||||
// An estimate is that we can print about 1e8 lines/seconds, so 32 digits
|
||||
// would be enough for billions of universe lifetimes.
|
||||
|
@ -275,8 +273,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(
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<!-- spell-checker:ignore (vars) RFILE -->
|
||||
# chcon
|
||||
|
||||
```
|
||||
chcon [OPTION]... CONTEXT FILE...
|
||||
chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
|
||||
chcon [OPTION]... --reference=RFILE FILE...
|
||||
```
|
||||
|
||||
Change the SELinux security context of each FILE to CONTEXT.
|
||||
With --reference, change the security context of each FILE to that of RFILE.
|
5
src/uu/chcon/locales/en-US.ftl
Normal file
5
src/uu/chcon/locales/en-US.ftl
Normal file
|
@ -0,0 +1,5 @@
|
|||
chcon-about = Change the SELinux security context of each FILE to CONTEXT.
|
||||
With --reference, change the security context of each FILE to that of RFILE.
|
||||
chcon-usage = chcon [OPTION]... CONTEXT FILE...
|
||||
chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
|
||||
chcon [OPTION]... --reference=RFILE FILE...
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use clap::builder::ValueParser;
|
||||
use uucore::error::{UResult, USimpleError, UUsageError};
|
||||
use uucore::{display::Quotable, format_usage, help_about, help_usage, show_error, show_warning};
|
||||
use uucore::{display::Quotable, format_usage, show_error, show_warning};
|
||||
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
use selinux::{OpaqueSecurityContext, SecurityContext};
|
||||
|
@ -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::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)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<!-- spell-checker:ignore (vars) RFILE -->
|
||||
|
||||
# chgrp
|
||||
|
||||
```
|
||||
chgrp [OPTION]... GROUP FILE...
|
||||
chgrp [OPTION]... --reference=RFILE FILE...
|
||||
```
|
||||
|
||||
Change the group of each FILE to GROUP.
|
3
src/uu/chgrp/locales/en-US.ftl
Normal file
3
src/uu/chgrp/locales/en-US.ftl
Normal file
|
@ -0,0 +1,3 @@
|
|||
chgrp-about = Change the group of each FILE to GROUP.
|
||||
chgrp-usage = chgrp [OPTION]... GROUP FILE...
|
||||
chgrp [OPTION]... --reference=RFILE FILE...
|
|
@ -8,16 +8,15 @@
|
|||
use uucore::display::Quotable;
|
||||
pub use uucore::entries;
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::format_usage;
|
||||
use uucore::perms::{GidUidOwnerFilter, IfFrom, chown_base, options};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
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::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(
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<!-- spell-checker:ignore RFILE ugoa -->
|
||||
|
||||
# chmod
|
||||
|
||||
```
|
||||
chmod [OPTION]... MODE[,MODE]... FILE...
|
||||
chmod [OPTION]... OCTAL-MODE FILE...
|
||||
chmod [OPTION]... --reference=RFILE FILE...
|
||||
```
|
||||
|
||||
Change the mode of each FILE to MODE.
|
||||
With --reference, change the mode of each FILE to that of RFILE.
|
||||
|
||||
## After Help
|
||||
|
||||
Each MODE is of the form `[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+`.
|
6
src/uu/chmod/locales/en-US.ftl
Normal file
6
src/uu/chmod/locales/en-US.ftl
Normal file
|
@ -0,0 +1,6 @@
|
|||
chmod-about = Change the mode of each FILE to MODE.
|
||||
With --reference, change the mode of each FILE to that of RFILE.
|
||||
chmod-usage = chmod [OPTION]... MODE[,MODE]... FILE...
|
||||
chmod [OPTION]... OCTAL-MODE FILE...
|
||||
chmod [OPTION]... --reference=RFILE FILE...
|
||||
chmod-after-help = Each MODE is of the form [ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+.
|
|
@ -17,11 +17,9 @@ use uucore::libc::mode_t;
|
|||
#[cfg(not(windows))]
|
||||
use uucore::mode;
|
||||
use uucore::perms::{TraverseSymlinks, configure_symlink_and_recursion};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show, show_error};
|
||||
use uucore::{format_usage, show, show_error};
|
||||
|
||||
const ABOUT: &str = help_about!("chmod.md");
|
||||
const USAGE: &str = help_usage!("chmod.md");
|
||||
const LONG_USAGE: &str = help_section!("after help", "chmod.md");
|
||||
use uucore::locale::get_message;
|
||||
|
||||
mod options {
|
||||
pub const HELP: &str = "help";
|
||||
|
@ -94,7 +92,9 @@ fn extract_negative_modes(mut args: impl uucore::Args) -> (Option<String>, Vec<O
|
|||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let (parsed_cmode, args) = extract_negative_modes(args.skip(1)); // skip binary name
|
||||
let matches = uu_app().after_help(LONG_USAGE).try_get_matches_from(args)?;
|
||||
let matches = uu_app()
|
||||
.after_help(get_message("chmod-after-help"))
|
||||
.try_get_matches_from(args)?;
|
||||
|
||||
let changes = matches.get_flag(options::CHANGES);
|
||||
let quiet = matches.get_flag(options::QUIET);
|
||||
|
@ -159,8 +159,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)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<!-- spell-checker:ignore RFILE -->
|
||||
# chown
|
||||
|
||||
```
|
||||
chown [OPTION]... [OWNER][:[GROUP]] FILE...
|
||||
chown [OPTION]... --reference=RFILE FILE...
|
||||
```
|
||||
|
||||
Change file owner and group
|
3
src/uu/chown/locales/en-US.ftl
Normal file
3
src/uu/chown/locales/en-US.ftl
Normal file
|
@ -0,0 +1,3 @@
|
|||
chown-about = Change file owner and group
|
||||
chown-usage = chown [OPTION]... [OWNER][:[GROUP]] FILE...
|
||||
chown [OPTION]... --reference=RFILE FILE...
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
use uucore::display::Quotable;
|
||||
pub use uucore::entries::{self, Group, Locate, Passwd};
|
||||
use uucore::format_usage;
|
||||
use uucore::perms::{GidUidOwnerFilter, IfFrom, chown_base, options};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
|
||||
|
@ -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::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(
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<!-- spell-checker:ignore NEWROOT -->
|
||||
# chroot
|
||||
|
||||
```
|
||||
chroot [OPTION]... NEWROOT [COMMAND [ARG]...]
|
||||
```
|
||||
|
||||
Run COMMAND with root directory set to NEWROOT.
|
2
src/uu/chroot/locales/en-US.ftl
Normal file
2
src/uu/chroot/locales/en-US.ftl
Normal file
|
@ -0,0 +1,2 @@
|
|||
chroot-about = Run COMMAND with root directory set to NEWROOT.
|
||||
chroot-usage = chroot [OPTION]... NEWROOT [COMMAND [ARG]...]
|
|
@ -17,10 +17,9 @@ use uucore::entries::{Locate, Passwd, grp2gid, usr2uid};
|
|||
use uucore::error::{UClapError, UResult, UUsageError, set_exit_code};
|
||||
use uucore::fs::{MissingHandling, ResolveMode, canonicalize};
|
||||
use uucore::libc::{self, chroot, setgid, setgroups, setuid};
|
||||
use uucore::{format_usage, help_about, help_usage, show};
|
||||
use uucore::{format_usage, show};
|
||||
|
||||
static ABOUT: &str = help_about!("chroot.md");
|
||||
static USAGE: &str = help_usage!("chroot.md");
|
||||
use uucore::locale::get_message;
|
||||
|
||||
mod options {
|
||||
pub const NEWROOT: &str = "newroot";
|
||||
|
@ -237,8 +236,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(
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
# cksum
|
||||
|
||||
```
|
||||
cksum [OPTIONS] [FILE]...
|
||||
```
|
||||
|
||||
Print CRC and size for each file
|
||||
|
||||
## After Help
|
||||
|
||||
DIGEST determines the digest algorithm and default output format:
|
||||
|
||||
- `sysv`: (equivalent to sum -s)
|
||||
- `bsd`: (equivalent to sum -r)
|
||||
- `crc`: (equivalent to cksum)
|
||||
- `crc32b`: (only available through cksum)
|
||||
- `md5`: (equivalent to md5sum)
|
||||
- `sha1`: (equivalent to sha1sum)
|
||||
- `sha224`: (equivalent to sha224sum)
|
||||
- `sha256`: (equivalent to sha256sum)
|
||||
- `sha384`: (equivalent to sha384sum)
|
||||
- `sha512`: (equivalent to sha512sum)
|
||||
- `blake2b`: (equivalent to b2sum)
|
||||
- `sm3`: (only available through cksum)
|
16
src/uu/cksum/locales/en-US.ftl
Normal file
16
src/uu/cksum/locales/en-US.ftl
Normal file
|
@ -0,0 +1,16 @@
|
|||
cksum-about = Print CRC and size for each file
|
||||
cksum-usage = cksum [OPTIONS] [FILE]...
|
||||
cksum-after-help = DIGEST determines the digest algorithm and default output format:
|
||||
|
||||
- sysv: (equivalent to sum -s)
|
||||
- bsd: (equivalent to sum -r)
|
||||
- crc: (equivalent to cksum)
|
||||
- crc32b: (only available through cksum)
|
||||
- md5: (equivalent to md5sum)
|
||||
- sha1: (equivalent to sha1sum)
|
||||
- sha224: (equivalent to sha224sum)
|
||||
- sha256: (equivalent to sha256sum)
|
||||
- sha384: (equivalent to sha384sum)
|
||||
- sha512: (equivalent to sha512sum)
|
||||
- blake2b: (equivalent to b2sum)
|
||||
- sm3: (only available through cksum)
|
|
@ -17,19 +17,16 @@ use uucore::checksum::{
|
|||
ChecksumVerbose, SUPPORTED_ALGORITHMS, calculate_blake2b_length, detect_algo, digest_reader,
|
||||
perform_checksum_validation,
|
||||
};
|
||||
use uucore::locale::get_message;
|
||||
use uucore::{
|
||||
encoding,
|
||||
error::{FromIo, UResult, USimpleError},
|
||||
format_usage, help_about, help_section, help_usage,
|
||||
format_usage,
|
||||
line_ending::LineEnding,
|
||||
os_str_as_bytes, show,
|
||||
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");
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
enum OutputFormat {
|
||||
Hexadecimal,
|
||||
|
@ -343,8 +340,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 +465,7 @@ pub fn uu_app() -> Command {
|
|||
)
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.after_help(AFTER_HELP)
|
||||
.after_help(get_message("cksum-after-help"))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
# comm
|
||||
|
||||
```
|
||||
comm [OPTION]... FILE1 FILE2
|
||||
```
|
||||
|
||||
Compare two sorted files line by line.
|
||||
|
||||
When FILE1 or FILE2 (not both) is -, read standard input.
|
||||
|
||||
With no options, produce three-column output. Column one contains
|
||||
lines unique to FILE1, column two contains lines unique to FILE2,
|
||||
and column three contains lines common to both files.
|
8
src/uu/comm/locales/en-US.ftl
Normal file
8
src/uu/comm/locales/en-US.ftl
Normal file
|
@ -0,0 +1,8 @@
|
|||
comm-about = Compare two sorted files line by line.
|
||||
|
||||
When FILE1 or FILE2 (not both) is -, read standard input.
|
||||
|
||||
With no options, produce three-column output. Column one contains
|
||||
lines unique to FILE1, column two contains lines unique to FILE2,
|
||||
and column three contains lines common to both files.
|
||||
comm-usage = comm [OPTION]... FILE1 FILE2
|
|
@ -9,14 +9,13 @@ use std::cmp::Ordering;
|
|||
use std::fs::{File, metadata};
|
||||
use std::io::{self, BufRead, BufReader, Read, Stdin, stdin};
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::format_usage;
|
||||
use uucore::fs::paths_refer_to_same_file;
|
||||
use uucore::line_ending::LineEnding;
|
||||
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::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(
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# cp
|
||||
|
||||
```
|
||||
cp [OPTION]... [-T] SOURCE DEST
|
||||
cp [OPTION]... SOURCE... DIRECTORY
|
||||
cp [OPTION]... -t DIRECTORY SOURCE...
|
||||
```
|
||||
|
||||
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
|
||||
|
||||
## After Help
|
||||
|
||||
Do not copy a non-directory that has an existing destination with the same or newer modification timestamp;
|
||||
instead, silently skip the file without failing. If timestamps are being preserved, the comparison is to the
|
||||
source timestamp truncated to the resolutions of the destination file system and of the system calls used to
|
||||
update timestamps; this avoids duplicate work if several `cp -pu` commands are executed with the same source
|
||||
and destination. This option is ignored if the `-n` or `--no-clobber` option is also specified. Also, if
|
||||
`--preserve=links` is also specified (like with `cp -au` for example), that will take precedence; consequently,
|
||||
depending on the order that files are processed from the source, newer files in the destination may be replaced,
|
||||
to mirror hard links in the source. which gives more control over which existing files in the destination are
|
||||
replaced, and its value can be one of the following:
|
||||
|
||||
* `all` This is the default operation when an `--update` option is not specified, and results in all existing files in the destination being replaced.
|
||||
* `none` This is similar to the `--no-clobber` option, in that no files in the destination are replaced, but also skipping a file does not induce a failure.
|
||||
* `older` This is the default operation when `--update` is specified, and results in files being replaced if they’re older than the corresponding source file.
|
17
src/uu/cp/locales/en-US.ftl
Normal file
17
src/uu/cp/locales/en-US.ftl
Normal file
|
@ -0,0 +1,17 @@
|
|||
cp-about = Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
|
||||
cp-usage = cp [OPTION]... [-T] SOURCE DEST
|
||||
cp [OPTION]... SOURCE... DIRECTORY
|
||||
cp [OPTION]... -t DIRECTORY SOURCE...
|
||||
cp-after-help = Do not copy a non-directory that has an existing destination with the same or newer modification timestamp;
|
||||
instead, silently skip the file without failing. If timestamps are being preserved, the comparison is to the
|
||||
source timestamp truncated to the resolutions of the destination file system and of the system calls used to
|
||||
update timestamps; this avoids duplicate work if several cp -pu commands are executed with the same source
|
||||
and destination. This option is ignored if the -n or --no-clobber option is also specified. Also, if
|
||||
--preserve=links is also specified (like with cp -au for example), that will take precedence; consequently,
|
||||
depending on the order that files are processed from the source, newer files in the destination may be replaced,
|
||||
to mirror hard links in the source. which gives more control over which existing files in the destination are
|
||||
replaced, and its value can be one of the following:
|
||||
|
||||
- all This is the default operation when an --update option is not specified, and results in all existing files in the destination being replaced.
|
||||
- none This is similar to the --no-clobber option, in that no files in the destination are replaced, but also skipping a file does not induce a failure.
|
||||
- older This is the default operation when --update is specified, and results in files being replaced if they’re older than the corresponding source file.
|
|
@ -36,11 +36,12 @@ use uucore::{backup_control, update_control};
|
|||
// requires these enum.
|
||||
pub use uucore::{backup_control::BackupMode, update_control::UpdateMode};
|
||||
use uucore::{
|
||||
format_usage, help_about, help_section, help_usage,
|
||||
parser::shortcut_value_parser::ShortcutValueParser, prompt_yes, show_error, show_warning,
|
||||
format_usage, parser::shortcut_value_parser::ShortcutValueParser, prompt_yes, show_error,
|
||||
show_warning,
|
||||
};
|
||||
|
||||
use crate::copydir::copy_directory;
|
||||
use uucore::locale::get_message;
|
||||
|
||||
mod copydir;
|
||||
mod platform;
|
||||
|
@ -451,10 +452,6 @@ 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");
|
||||
|
||||
static EXIT_ERR: i32 = 1;
|
||||
|
||||
// Argument constants
|
||||
|
@ -523,10 +520,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)
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# csplit
|
||||
|
||||
```
|
||||
csplit [OPTION]... FILE PATTERN...
|
||||
```
|
||||
|
||||
Split a file into sections determined by context lines
|
||||
|
||||
## After Help
|
||||
|
||||
Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output.
|
3
src/uu/csplit/locales/en-US.ftl
Normal file
3
src/uu/csplit/locales/en-US.ftl
Normal file
|
@ -0,0 +1,3 @@
|
|||
csplit-about = Split a file into sections determined by context lines
|
||||
csplit-usage = csplit [OPTION]... FILE PATTERN...
|
||||
csplit-after-help = Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output.
|
|
@ -16,7 +16,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command};
|
|||
use regex::Regex;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UResult};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
use uucore::format_usage;
|
||||
|
||||
mod csplit_error;
|
||||
mod patterns;
|
||||
|
@ -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::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)]
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
# cut
|
||||
|
||||
<!-- spell-checker:ignore sourcefile sourcefiles -->
|
||||
|
||||
```
|
||||
cut OPTION... [FILE]...
|
||||
```
|
||||
|
||||
Prints specified byte or field columns from each line of stdin or the input files
|
||||
|
||||
## After Help
|
||||
|
||||
Each call must specify a mode (what to use for columns),
|
||||
a sequence (which columns to print), and provide a data source
|
||||
|
||||
### Specifying a mode
|
||||
|
||||
Use `--bytes` (`-b`) or `--characters` (`-c`) to specify byte mode
|
||||
|
||||
Use `--fields` (`-f`) to specify field mode, where each line is broken into
|
||||
fields identified by a delimiter character. For example for a typical CSV
|
||||
you could use this in combination with setting comma as the delimiter
|
||||
|
||||
### Specifying a sequence
|
||||
|
||||
A sequence is a group of 1 or more numbers or inclusive ranges separated
|
||||
by a commas.
|
||||
|
||||
```
|
||||
cut -f 2,5-7 some_file.txt
|
||||
```
|
||||
|
||||
will display the 2nd, 5th, 6th, and 7th field for each source line
|
||||
|
||||
Ranges can extend to the end of the row by excluding the second number
|
||||
|
||||
```
|
||||
cut -f 3- some_file.txt
|
||||
```
|
||||
|
||||
will display the 3rd field and all fields after for each source line
|
||||
|
||||
The first number of a range can be excluded, and this is effectively the
|
||||
same as using 1 as the first number: it causes the range to begin at the
|
||||
first column. Ranges can also display a single column
|
||||
|
||||
```
|
||||
cut -f 1,3-5 some_file.txt
|
||||
```
|
||||
|
||||
will display the 1st, 3rd, 4th, and 5th field for each source line
|
||||
|
||||
The `--complement` option, when used, inverts the effect of the sequence
|
||||
|
||||
```
|
||||
cut --complement -f 4-6 some_file.txt
|
||||
```
|
||||
|
||||
will display the every field but the 4th, 5th, and 6th
|
||||
|
||||
### Specifying a data source
|
||||
|
||||
If no `sourcefile` arguments are specified, stdin is used as the source of
|
||||
lines to print
|
||||
|
||||
If `sourcefile` arguments are specified, stdin is ignored and all files are
|
||||
read in consecutively if a `sourcefile` is not successfully read, a warning
|
||||
will print to stderr, and the eventual status code will be 1, but cut
|
||||
will continue to read through proceeding `sourcefiles`
|
||||
|
||||
To print columns from both STDIN and a file argument, use `-` (dash) as a
|
||||
`sourcefile` argument to represent stdin.
|
||||
|
||||
### Field Mode options
|
||||
|
||||
The fields in each line are identified by a delimiter (separator)
|
||||
|
||||
#### Set the delimiter
|
||||
|
||||
Set the delimiter which separates fields in the file using the
|
||||
`--delimiter` (`-d`) option. Setting the delimiter is optional.
|
||||
If not set, a default delimiter of Tab will be used.
|
||||
|
||||
If the `-w` option is provided, fields will be separated by any number
|
||||
of whitespace characters (Space and Tab). The output delimiter will
|
||||
be a Tab unless explicitly specified. Only one of `-d` or `-w` option can be specified.
|
||||
This is an extension adopted from FreeBSD.
|
||||
|
||||
#### Optionally Filter based on delimiter
|
||||
|
||||
If the `--only-delimited` (`-s`) flag is provided, only lines which
|
||||
contain the delimiter will be printed
|
||||
|
||||
#### Replace the delimiter
|
||||
|
||||
If the `--output-delimiter` option is provided, the argument used for
|
||||
it will replace the delimiter character in each line printed. This is
|
||||
useful for transforming tabular data - e.g. to convert a CSV to a
|
||||
TSV (tab-separated file)
|
||||
|
||||
### Line endings
|
||||
|
||||
When the `--zero-terminated` (`-z`) option is used, cut sees \\0 (null) as the
|
||||
'line ending' character (both for the purposes of reading lines and
|
||||
separating printed lines) instead of \\n (newline). This is useful for
|
||||
tabular data where some of the cells may contain newlines
|
||||
|
||||
```
|
||||
echo 'ab\\0cd' | cut -z -c 1
|
||||
```
|
||||
|
||||
will result in 'a\\0c\\0'
|
92
src/uu/cut/locales/en-US.ftl
Normal file
92
src/uu/cut/locales/en-US.ftl
Normal file
|
@ -0,0 +1,92 @@
|
|||
cut-about = Prints specified byte or field columns from each line of stdin or the input files
|
||||
cut-usage = cut OPTION... [FILE]...
|
||||
cut-after-help = Each call must specify a mode (what to use for columns),
|
||||
a sequence (which columns to print), and provide a data source
|
||||
|
||||
### Specifying a mode
|
||||
|
||||
Use --bytes (-b) or --characters (-c) to specify byte mode
|
||||
|
||||
Use --fields (-f) to specify field mode, where each line is broken into
|
||||
fields identified by a delimiter character. For example for a typical CSV
|
||||
you could use this in combination with setting comma as the delimiter
|
||||
|
||||
### Specifying a sequence
|
||||
|
||||
A sequence is a group of 1 or more numbers or inclusive ranges separated
|
||||
by a commas.
|
||||
|
||||
cut -f 2,5-7 some_file.txt
|
||||
|
||||
will display the 2nd, 5th, 6th, and 7th field for each source line
|
||||
|
||||
Ranges can extend to the end of the row by excluding the second number
|
||||
|
||||
cut -f 3- some_file.txt
|
||||
|
||||
will display the 3rd field and all fields after for each source line
|
||||
|
||||
The first number of a range can be excluded, and this is effectively the
|
||||
same as using 1 as the first number: it causes the range to begin at the
|
||||
first column. Ranges can also display a single column
|
||||
|
||||
cut -f 1,3-5 some_file.txt
|
||||
|
||||
will display the 1st, 3rd, 4th, and 5th field for each source line
|
||||
|
||||
The --complement option, when used, inverts the effect of the sequence
|
||||
|
||||
cut --complement -f 4-6 some_file.txt
|
||||
|
||||
will display the every field but the 4th, 5th, and 6th
|
||||
|
||||
### Specifying a data source
|
||||
|
||||
If no sourcefile arguments are specified, stdin is used as the source of
|
||||
lines to print
|
||||
|
||||
If sourcefile arguments are specified, stdin is ignored and all files are
|
||||
read in consecutively if a sourcefile is not successfully read, a warning
|
||||
will print to stderr, and the eventual status code will be 1, but cut
|
||||
will continue to read through proceeding sourcefiles
|
||||
|
||||
To print columns from both STDIN and a file argument, use - (dash) as a
|
||||
sourcefile argument to represent stdin.
|
||||
|
||||
### Field Mode options
|
||||
|
||||
The fields in each line are identified by a delimiter (separator)
|
||||
|
||||
#### Set the delimiter
|
||||
|
||||
Set the delimiter which separates fields in the file using the
|
||||
--delimiter (-d) option. Setting the delimiter is optional.
|
||||
If not set, a default delimiter of Tab will be used.
|
||||
|
||||
If the -w option is provided, fields will be separated by any number
|
||||
of whitespace characters (Space and Tab). The output delimiter will
|
||||
be a Tab unless explicitly specified. Only one of -d or -w option can be specified.
|
||||
This is an extension adopted from FreeBSD.
|
||||
|
||||
#### Optionally Filter based on delimiter
|
||||
|
||||
If the --only-delimited (-s) flag is provided, only lines which
|
||||
contain the delimiter will be printed
|
||||
|
||||
#### Replace the delimiter
|
||||
|
||||
If the --output-delimiter option is provided, the argument used for
|
||||
it will replace the delimiter character in each line printed. This is
|
||||
useful for transforming tabular data - e.g. to convert a CSV to a
|
||||
TSV (tab-separated file)
|
||||
|
||||
### Line endings
|
||||
|
||||
When the --zero-terminated (-z) option is used, cut sees \\0 (null) as the
|
||||
'line ending' character (both for the purposes of reading lines and
|
||||
separating printed lines) instead of \\n (newline). This is useful for
|
||||
tabular data where some of the cells may contain newlines
|
||||
|
||||
echo 'ab\\0cd' | cut -z -c 1
|
||||
|
||||
will result in 'a\\0c\\0'
|
|
@ -18,16 +18,13 @@ use uucore::os_str_as_bytes;
|
|||
|
||||
use self::searcher::Searcher;
|
||||
use matcher::{ExactMatcher, Matcher, WhitespaceMatcher};
|
||||
use uucore::locale::get_message;
|
||||
use uucore::ranges::Range;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show_error, show_if_err};
|
||||
use uucore::{format_usage, show_error, show_if_err};
|
||||
|
||||
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");
|
||||
|
||||
struct Options<'a> {
|
||||
out_delimiter: Option<&'a [u8]>,
|
||||
line_ending: LineEnding,
|
||||
|
@ -580,9 +577,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,
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
# `date` usage
|
||||
|
||||
<!-- spell-checker:ignore (format) hhmm -->
|
||||
|
||||
FORMAT controls the output. Interpreted sequences are:
|
||||
|
||||
| Sequence | Description | Example |
|
||||
| -------- | -------------------------------------------------------------------- | ---------------------- |
|
||||
| %% | a literal % | % |
|
||||
| %a | locale's abbreviated weekday name | Sun |
|
||||
| %A | locale's full weekday name | Sunday |
|
||||
| %b | locale's abbreviated month name | Jan |
|
||||
| %B | locale's full month name | January |
|
||||
| %c | locale's date and time | Thu Mar 3 23:05:25 2005|
|
||||
| %C | century; like %Y, except omit last two digits | 20 |
|
||||
| %d | day of month | 01 |
|
||||
| %D | date; same as %m/%d/%y | 12/31/99 |
|
||||
| %e | day of month, space padded; same as %_d | 3 |
|
||||
| %F | full date; same as %Y-%m-%d | 2005-03-03 |
|
||||
| %g | last two digits of year of ISO week number (see %G) | 05 |
|
||||
| %G | year of ISO week number (see %V); normally useful only with %V | 2005 |
|
||||
| %h | same as %b | Jan |
|
||||
| %H | hour (00..23) | 23 |
|
||||
| %I | hour (01..12) | 11 |
|
||||
| %j | day of year (001..366) | 062 |
|
||||
| %k | hour, space padded ( 0..23); same as %_H | 3 |
|
||||
| %l | hour, space padded ( 1..12); same as %_I | 9 |
|
||||
| %m | month (01..12) | 03 |
|
||||
| %M | minute (00..59) | 30 |
|
||||
| %n | a newline | \n |
|
||||
| %N | nanoseconds (000000000..999999999) | 123456789 |
|
||||
| %p | locale's equivalent of either AM or PM; blank if not known | PM |
|
||||
| %P | like %p, but lower case | pm |
|
||||
| %q | quarter of year (1..4) | 1 |
|
||||
| %r | locale's 12-hour clock time | 11:11:04 PM |
|
||||
| %R | 24-hour hour and minute; same as %H:%M | 23:30 |
|
||||
| %s | seconds since 1970-01-01 00:00:00 UTC | 1615432800 |
|
||||
| %S | second (00..60) | 30 |
|
||||
| %t | a tab | \t |
|
||||
| %T | time; same as %H:%M:%S | 23:30:30 |
|
||||
| %u | day of week (1..7); 1 is Monday | 4 |
|
||||
| %U | week number of year, with Sunday as first day of week (00..53) | 10 |
|
||||
| %V | ISO week number, with Monday as first day of week (01..53) | 12 |
|
||||
| %w | day of week (0..6); 0 is Sunday | 4 |
|
||||
| %W | week number of year, with Monday as first day of week (00..53) | 11 |
|
||||
| %x | locale's date representation | 03/03/2005 |
|
||||
| %X | locale's time representation | 23:30:30 |
|
||||
| %y | last two digits of year (00..99) | 05 |
|
||||
| %Y | year | 2005 |
|
||||
| %z | +hhmm numeric time zone | -0400 |
|
||||
| %:z | +hh:mm numeric time zone | -04:00 |
|
||||
| %::z | +hh:mm:ss numeric time zone | -04:00:00 |
|
||||
| %:::z | numeric time zone with : to necessary precision | -04, +05:30 |
|
||||
| %Z | alphabetic time zone abbreviation | EDT |
|
||||
|
||||
By default, date pads numeric fields with zeroes.
|
||||
The following optional flags may follow '%':
|
||||
|
||||
* `-` (hyphen) do not pad the field
|
||||
* `_` (underscore) pad with spaces
|
||||
* `0` (zero) pad with zeros
|
||||
* `^` use upper case if possible
|
||||
* `#` use opposite case if possible
|
||||
|
||||
After any flags comes an optional field width, as a decimal number;
|
||||
then an optional modifier, which is either
|
||||
E to use the locale's alternate representations if available, or
|
||||
O to use the locale's alternate numeric symbols if available.
|
||||
|
||||
Examples:
|
||||
Convert seconds since the epoch (1970-01-01 UTC) to a date
|
||||
|
||||
```
|
||||
date --date='@2147483647'
|
||||
```
|
||||
|
||||
Show the time on the west coast of the US (use tzselect(1) to find TZ)
|
||||
|
||||
```
|
||||
TZ='America/Los_Angeles' date
|
||||
```
|
|
@ -1,10 +0,0 @@
|
|||
<!-- spell-checker:ignore Dhhmm -->
|
||||
|
||||
# date
|
||||
|
||||
```
|
||||
date [OPTION]... [+FORMAT]...
|
||||
date [OPTION]... [MMDDhhmm[[CC]YY][.ss]]
|
||||
```
|
||||
|
||||
Print or set the system date and time
|
76
src/uu/date/locales/en-US.ftl
Normal file
76
src/uu/date/locales/en-US.ftl
Normal file
|
@ -0,0 +1,76 @@
|
|||
date-about =
|
||||
Print or set the system date and time
|
||||
|
||||
date-usage =
|
||||
date [OPTION]... [+FORMAT]...
|
||||
date [OPTION]... [MMDDhhmm[[CC]YY][.ss]]
|
||||
|
||||
FORMAT controls the output. Interpreted sequences are:
|
||||
{ "| Sequence | Description | Example |" }
|
||||
{ "| -------- | -------------------------------------------------------------------- | ---------------------- |" }
|
||||
{ "| %% | a literal % | % |" }
|
||||
{ "| %a | locale's abbreviated weekday name | Sun |" }
|
||||
{ "| %A | locale's full weekday name | Sunday |" }
|
||||
{ "| %b | locale's abbreviated month name | Jan |" }
|
||||
{ "| %B | locale's full month name | January |" }
|
||||
{ "| %c | locale's date and time | Thu Mar 3 23:05:25 2005|" }
|
||||
{ "| %C | century; like %Y, except omit last two digits | 20 |" }
|
||||
{ "| %d | day of month | 01 |" }
|
||||
{ "| %D | date; same as %m/%d/%y | 12/31/99 |" }
|
||||
{ "| %e | day of month, space padded; same as %_d | 3 |" }
|
||||
{ "| %F | full date; same as %Y-%m-%d | 2005-03-03 |" }
|
||||
{ "| %g | last two digits of year of ISO week number (see %G) | 05 |" }
|
||||
{ "| %G | year of ISO week number (see %V); normally useful only with %V | 2005 |" }
|
||||
{ "| %h | same as %b | Jan |" }
|
||||
{ "| %H | hour (00..23) | 23 |" }
|
||||
{ "| %I | hour (01..12) | 11 |" }
|
||||
{ "| %j | day of year (001..366) | 062 |" }
|
||||
{ "| %k | hour, space padded ( 0..23); same as %_H | 3 |" }
|
||||
{ "| %l | hour, space padded ( 1..12); same as %_I | 9 |" }
|
||||
{ "| %m | month (01..12) | 03 |" }
|
||||
{ "| %M | minute (00..59) | 30 |" }
|
||||
{ "| %n | a newline | \\n |" }
|
||||
{ "| %N | nanoseconds (000000000..999999999) | 123456789 |" }
|
||||
{ "| %p | locale's equivalent of either AM or PM; blank if not known | PM |" }
|
||||
{ "| %P | like %p, but lower case | pm |" }
|
||||
{ "| %q | quarter of year (1..4) | 1 |" }
|
||||
{ "| %r | locale's 12-hour clock time | 11:11:04 PM |" }
|
||||
{ "| %R | 24-hour hour and minute; same as %H:%M | 23:30 |" }
|
||||
{ "| %s | seconds since 1970-01-01 00:00:00 UTC | 1615432800 |" }
|
||||
{ "| %S | second (00..60) | 30 |" }
|
||||
{ "| %t | a tab | \\t |" }
|
||||
{ "| %T | time; same as %H:%M:%S | 23:30:30 |" }
|
||||
{ "| %u | day of week (1..7); 1 is Monday | 4 |" }
|
||||
{ "| %U | week number of year, with Sunday as first day of week (00..53) | 10 |" }
|
||||
{ "| %V | ISO week number, with Monday as first day of week (01..53) | 12 |" }
|
||||
{ "| %w | day of week (0..6); 0 is Sunday | 4 |" }
|
||||
{ "| %W | week number of year, with Monday as first day of week (00..53) | 11 |" }
|
||||
{ "| %x | locale's date representation | 03/03/2005 |" }
|
||||
{ "| %X | locale's time representation | 23:30:30 |" }
|
||||
{ "| %y | last two digits of year (00..99) | 05 |" }
|
||||
{ "| %Y | year | 2005 |" }
|
||||
{ "| %z | +hhmm numeric time zone | -0400 |" }
|
||||
{ "| %:z | +hh:mm numeric time zone | -04:00 |" }
|
||||
{ "| %::z | +hh:mm:ss numeric time zone | -04:00:00 |" }
|
||||
{ "| %:::z | numeric time zone with : to necessary precision | -04, +05:30 |" }
|
||||
{ "| %Z | alphabetic time zone abbreviation | EDT |" }
|
||||
|
||||
By default, date pads numeric fields with zeroes.
|
||||
The following optional flags may follow '%':
|
||||
{ "* `-` (hyphen) do not pad the field" }
|
||||
{ "* `_` (underscore) pad with spaces" }
|
||||
{ "* `0` (zero) pad with zeros" }
|
||||
{ "* `^` use upper case if possible" }
|
||||
{ "* `#` use opposite case if possible" }
|
||||
After any flags comes an optional field width, as a decimal number;
|
||||
then an optional modifier, which is either
|
||||
{ "* `E` to use the locale's alternate representations if available, or" }
|
||||
{ "* `O` to use the locale's alternate numeric symbols if available." }
|
||||
Examples:
|
||||
Convert seconds since the epoch (1970-01-01 UTC) to a date
|
||||
|
||||
date --date='@2147483647'
|
||||
|
||||
Show the time on the west coast of the US (use tzselect(1) to find TZ)
|
||||
|
||||
TZ='America/Los_Angeles' date
|
|
@ -17,10 +17,11 @@ use std::path::PathBuf;
|
|||
use uucore::display::Quotable;
|
||||
use uucore::error::FromIo;
|
||||
use uucore::error::{UResult, USimpleError};
|
||||
use uucore::{format_usage, help_about, help_usage, show};
|
||||
use uucore::{format_usage, show};
|
||||
#[cfg(windows)]
|
||||
use windows_sys::Win32::{Foundation::SYSTEMTIME, System::SystemInformation::SetSystemTime};
|
||||
|
||||
use uucore::locale::get_message;
|
||||
use uucore::parser::shortcut_value_parser::ShortcutValueParser;
|
||||
|
||||
// Options
|
||||
|
@ -30,9 +31,6 @@ 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");
|
||||
|
||||
const OPT_DATE: &str = "date";
|
||||
const OPT_FORMAT: &str = "format";
|
||||
const OPT_FILE: &str = "file";
|
||||
|
@ -290,8 +288,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)
|
||||
|
|
126
src/uu/dd/dd.md
126
src/uu/dd/dd.md
|
@ -1,126 +0,0 @@
|
|||
# dd
|
||||
|
||||
<!-- spell-checker:ignore convs iseek oseek -->
|
||||
|
||||
```
|
||||
dd [OPERAND]...
|
||||
dd OPTION
|
||||
```
|
||||
|
||||
Copy, and optionally convert, a file system resource
|
||||
|
||||
## After Help
|
||||
|
||||
### Operands
|
||||
|
||||
- `bs=BYTES` : read and write up to BYTES bytes at a time (default: 512);
|
||||
overwrites `ibs` and `obs`.
|
||||
- `cbs=BYTES` : the 'conversion block size' in bytes. Applies to the
|
||||
`conv=block`, and `conv=unblock` operations.
|
||||
- `conv=CONVS` : a comma-separated list of conversion options or (for legacy
|
||||
reasons) file flags.
|
||||
- `count=N` : stop reading input after N ibs-sized read operations rather
|
||||
than proceeding until EOF. See `iflag=count_bytes` if stopping after N bytes
|
||||
is preferred
|
||||
- `ibs=N` : the size of buffer used for reads (default: 512)
|
||||
- `if=FILE` : the file used for input. When not specified, stdin is used instead
|
||||
- `iflag=FLAGS` : a comma-separated list of input flags which specify how the
|
||||
input source is treated. FLAGS may be any of the input-flags or general-flags
|
||||
specified below.
|
||||
- `skip=N` (or `iseek=N`) : skip N ibs-sized records into input before beginning
|
||||
copy/convert operations. See iflag=seek_bytes if seeking N bytes is preferred.
|
||||
- `obs=N` : the size of buffer used for writes (default: 512)
|
||||
- `of=FILE` : the file used for output. When not specified, stdout is used
|
||||
instead
|
||||
- `oflag=FLAGS` : comma separated list of output flags which specify how the
|
||||
output source is treated. FLAGS may be any of the output flags or general
|
||||
flags specified below
|
||||
- `seek=N` (or `oseek=N`) : seeks N obs-sized records into output before
|
||||
beginning copy/convert operations. See oflag=seek_bytes if seeking N bytes is
|
||||
preferred
|
||||
- `status=LEVEL` : controls whether volume and performance stats are written to
|
||||
stderr.
|
||||
|
||||
When unspecified, dd will print stats upon completion. An example is below.
|
||||
|
||||
```plain
|
||||
6+0 records in
|
||||
16+0 records out
|
||||
8192 bytes (8.2 kB, 8.0 KiB) copied, 0.00057009 s,
|
||||
14.4 MB/s
|
||||
```
|
||||
|
||||
The first two lines are the 'volume' stats and the final line is the
|
||||
'performance' stats.
|
||||
The volume stats indicate the number of complete and partial ibs-sized reads,
|
||||
or obs-sized writes that took place during the copy. The format of the volume
|
||||
stats is `<complete>+<partial>`. If records have been truncated (see
|
||||
`conv=block`), the volume stats will contain the number of truncated records.
|
||||
|
||||
Possible LEVEL values are:
|
||||
- `progress` : Print periodic performance stats as the copy proceeds.
|
||||
- `noxfer` : Print final volume stats, but not performance stats.
|
||||
- `none` : Do not print any stats.
|
||||
|
||||
Printing performance stats is also triggered by the INFO signal (where supported),
|
||||
or the USR1 signal. Setting the POSIXLY_CORRECT environment variable to any value
|
||||
(including an empty value) will cause the USR1 signal to be ignored.
|
||||
|
||||
### Conversion Options
|
||||
|
||||
- `ascii` : convert from EBCDIC to ASCII. This is the inverse of the `ebcdic`
|
||||
option. Implies `conv=unblock`.
|
||||
- `ebcdic` : convert from ASCII to EBCDIC. This is the inverse of the `ascii`
|
||||
option. Implies `conv=block`.
|
||||
- `ibm` : convert from ASCII to EBCDIC, applying the conventions for `[`, `]`
|
||||
and `~` specified in POSIX. Implies `conv=block`.
|
||||
|
||||
- `ucase` : convert from lower-case to upper-case.
|
||||
- `lcase` : converts from upper-case to lower-case.
|
||||
|
||||
- `block` : for each newline less than the size indicated by cbs=BYTES, remove
|
||||
the newline and pad with spaces up to cbs. Lines longer than cbs are truncated.
|
||||
- `unblock` : for each block of input of the size indicated by cbs=BYTES, remove
|
||||
right-trailing spaces and replace with a newline character.
|
||||
|
||||
- `sparse` : attempts to seek the output when an obs-sized block consists of
|
||||
only zeros.
|
||||
- `swab` : swaps each adjacent pair of bytes. If an odd number of bytes is
|
||||
present, the final byte is omitted.
|
||||
- `sync` : pad each ibs-sided block with zeros. If `block` or `unblock` is
|
||||
specified, pad with spaces instead.
|
||||
- `excl` : the output file must be created. Fail if the output file is already
|
||||
present.
|
||||
- `nocreat` : the output file will not be created. Fail if the output file in
|
||||
not already present.
|
||||
- `notrunc` : the output file will not be truncated. If this option is not
|
||||
present, output will be truncated when opened.
|
||||
- `noerror` : all read errors will be ignored. If this option is not present,
|
||||
dd will only ignore Error::Interrupted.
|
||||
- `fdatasync` : data will be written before finishing.
|
||||
- `fsync` : data and metadata will be written before finishing.
|
||||
|
||||
### Input flags
|
||||
|
||||
- `count_bytes` : a value to `count=N` will be interpreted as bytes.
|
||||
- `skip_bytes` : a value to `skip=N` will be interpreted as bytes.
|
||||
- `fullblock` : wait for ibs bytes from each read. zero-length reads are still
|
||||
considered EOF.
|
||||
|
||||
### Output flags
|
||||
|
||||
- `append` : open file in append mode. Consider setting conv=notrunc as well.
|
||||
- `seek_bytes` : a value to seek=N will be interpreted as bytes.
|
||||
|
||||
### General Flags
|
||||
|
||||
- `direct` : use direct I/O for data.
|
||||
- `directory` : fail unless the given input (if used as an iflag) or
|
||||
output (if used as an oflag) is a directory.
|
||||
- `dsync` : use synchronized I/O for data.
|
||||
- `sync` : use synchronized I/O for data and metadata.
|
||||
- `nonblock` : use non-blocking I/O.
|
||||
- `noatime` : do not update access time.
|
||||
- `nocache` : request that OS drop cache.
|
||||
- `noctty` : do not assign a controlling tty.
|
||||
- `nofollow` : do not follow system links.
|
115
src/uu/dd/locales/en-US.ftl
Normal file
115
src/uu/dd/locales/en-US.ftl
Normal file
|
@ -0,0 +1,115 @@
|
|||
dd-about = Copy, and optionally convert, a file system resource
|
||||
dd-usage = dd [OPERAND]...
|
||||
dd OPTION
|
||||
dd-after-help = ### Operands
|
||||
|
||||
- bs=BYTES : read and write up to BYTES bytes at a time (default: 512);
|
||||
overwrites ibs and obs.
|
||||
- cbs=BYTES : the 'conversion block size' in bytes. Applies to the
|
||||
conv=block, and conv=unblock operations.
|
||||
- conv=CONVS : a comma-separated list of conversion options or (for legacy
|
||||
reasons) file flags.
|
||||
- count=N : stop reading input after N ibs-sized read operations rather
|
||||
than proceeding until EOF. See iflag=count_bytes if stopping after N bytes
|
||||
is preferred
|
||||
- ibs=N : the size of buffer used for reads (default: 512)
|
||||
- if=FILE : the file used for input. When not specified, stdin is used instead
|
||||
- iflag=FLAGS : a comma-separated list of input flags which specify how the
|
||||
input source is treated. FLAGS may be any of the input-flags or general-flags
|
||||
specified below.
|
||||
- skip=N (or iseek=N) : skip N ibs-sized records into input before beginning
|
||||
copy/convert operations. See iflag=seek_bytes if seeking N bytes is preferred.
|
||||
- obs=N : the size of buffer used for writes (default: 512)
|
||||
- of=FILE : the file used for output. When not specified, stdout is used
|
||||
instead
|
||||
- oflag=FLAGS : comma separated list of output flags which specify how the
|
||||
output source is treated. FLAGS may be any of the output flags or general
|
||||
flags specified below
|
||||
- seek=N (or oseek=N) : seeks N obs-sized records into output before
|
||||
beginning copy/convert operations. See oflag=seek_bytes if seeking N bytes is
|
||||
preferred
|
||||
- status=LEVEL : controls whether volume and performance stats are written to
|
||||
stderr.
|
||||
|
||||
When unspecified, dd will print stats upon completion. An example is below.
|
||||
|
||||
```plain
|
||||
6+0 records in
|
||||
16+0 records out
|
||||
8192 bytes (8.2 kB, 8.0 KiB) copied, 0.00057009 s,
|
||||
14.4 MB/s
|
||||
|
||||
The first two lines are the 'volume' stats and the final line is the
|
||||
'performance' stats.
|
||||
The volume stats indicate the number of complete and partial ibs-sized reads,
|
||||
or obs-sized writes that took place during the copy. The format of the volume
|
||||
stats is <complete>+<partial>. If records have been truncated (see
|
||||
conv=block), the volume stats will contain the number of truncated records.
|
||||
|
||||
Possible LEVEL values are:
|
||||
- progress : Print periodic performance stats as the copy proceeds.
|
||||
- noxfer : Print final volume stats, but not performance stats.
|
||||
- none : Do not print any stats.
|
||||
|
||||
Printing performance stats is also triggered by the INFO signal (where supported),
|
||||
or the USR1 signal. Setting the POSIXLY_CORRECT environment variable to any value
|
||||
(including an empty value) will cause the USR1 signal to be ignored.
|
||||
|
||||
### Conversion Options
|
||||
|
||||
- ascii : convert from EBCDIC to ASCII. This is the inverse of the ebcdic
|
||||
option. Implies conv=unblock.
|
||||
- ebcdic : convert from ASCII to EBCDIC. This is the inverse of the ascii
|
||||
option. Implies conv=block.
|
||||
- ibm : convert from ASCII to EBCDIC, applying the conventions for [, ]
|
||||
and ~ specified in POSIX. Implies conv=block.
|
||||
|
||||
- ucase : convert from lower-case to upper-case.
|
||||
- lcase : converts from upper-case to lower-case.
|
||||
|
||||
- block : for each newline less than the size indicated by cbs=BYTES, remove
|
||||
the newline and pad with spaces up to cbs. Lines longer than cbs are truncated.
|
||||
- unblock : for each block of input of the size indicated by cbs=BYTES, remove
|
||||
right-trailing spaces and replace with a newline character.
|
||||
|
||||
- sparse : attempts to seek the output when an obs-sized block consists of
|
||||
only zeros.
|
||||
- swab : swaps each adjacent pair of bytes. If an odd number of bytes is
|
||||
present, the final byte is omitted.
|
||||
- sync : pad each ibs-sided block with zeros. If block or unblock is
|
||||
specified, pad with spaces instead.
|
||||
- excl : the output file must be created. Fail if the output file is already
|
||||
present.
|
||||
- nocreat : the output file will not be created. Fail if the output file in
|
||||
not already present.
|
||||
- notrunc : the output file will not be truncated. If this option is not
|
||||
present, output will be truncated when opened.
|
||||
- noerror : all read errors will be ignored. If this option is not present,
|
||||
dd will only ignore Error::Interrupted.
|
||||
- fdatasync : data will be written before finishing.
|
||||
- fsync : data and metadata will be written before finishing.
|
||||
|
||||
### Input flags
|
||||
|
||||
- count_bytes : a value to count=N will be interpreted as bytes.
|
||||
- skip_bytes : a value to skip=N will be interpreted as bytes.
|
||||
- fullblock : wait for ibs bytes from each read. zero-length reads are still
|
||||
considered EOF.
|
||||
|
||||
### Output flags
|
||||
|
||||
- append : open file in append mode. Consider setting conv=notrunc as well.
|
||||
- seek_bytes : a value to seek=N will be interpreted as bytes.
|
||||
|
||||
### General Flags
|
||||
|
||||
- direct : use direct I/O for data.
|
||||
- directory : fail unless the given input (if used as an iflag) or
|
||||
output (if used as an oflag) is a directory.
|
||||
- dsync : use synchronized I/O for data.
|
||||
- sync : use synchronized I/O for data and metadata.
|
||||
- nonblock : use non-blocking I/O.
|
||||
- noatime : do not update access time.
|
||||
- nocache : request that OS drop cache.
|
||||
- noctty : do not assign a controlling tty.
|
||||
- nofollow : do not follow system links.
|
|
@ -60,11 +60,9 @@ use uucore::error::{FromIo, UResult};
|
|||
use uucore::error::{USimpleError, set_exit_code};
|
||||
#[cfg(target_os = "linux")]
|
||||
use uucore::show_if_err;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
||||
use uucore::{format_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::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..))
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
# df
|
||||
|
||||
```
|
||||
df [OPTION]... [FILE]...
|
||||
```
|
||||
|
||||
Show information about the file system on which each FILE resides,
|
||||
or all file systems by default.
|
||||
|
||||
## After Help
|
||||
|
||||
Display values are in units of the first available SIZE from --block-size,
|
||||
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
|
||||
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
|
||||
|
||||
SIZE is an integer and optional unit (example: 10M is 10*1024*1024).
|
||||
Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers
|
||||
of 1000).
|
10
src/uu/df/locales/en-US.ftl
Normal file
10
src/uu/df/locales/en-US.ftl
Normal file
|
@ -0,0 +1,10 @@
|
|||
df-about = Show information about the file system on which each FILE resides,
|
||||
or all file systems by default.
|
||||
df-usage = df [OPTION]... [FILE]...
|
||||
df-after-help = Display values are in units of the first available SIZE from --block-size,
|
||||
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
|
||||
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
|
||||
|
||||
SIZE is an integer and optional unit (example: 10M is 10*1024*1024).
|
||||
Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers
|
||||
of 1000).
|
|
@ -15,7 +15,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{UError, UResult, USimpleError, get_exit_code};
|
||||
use uucore::fsext::{MountInfo, read_fs_list};
|
||||
use uucore::parser::parse_size::ParseSizeError;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show};
|
||||
use uucore::{format_usage, show};
|
||||
|
||||
use clap::{Arg, ArgAction, ArgMatches, Command, parser::ValueSource};
|
||||
|
||||
|
@ -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::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(
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
# dircolors
|
||||
|
||||
```
|
||||
dircolors [OPTION]... [FILE]
|
||||
```
|
||||
|
||||
Output commands to set the LS_COLORS environment variable.
|
||||
|
||||
## After Help
|
||||
|
||||
If FILE is specified, read it to determine which colors to use for which
|
||||
file types and extensions. Otherwise, a precompiled database is used.
|
||||
For details on the format of these files, run 'dircolors --print-database'
|
5
src/uu/dircolors/locales/en-US.ftl
Normal file
5
src/uu/dircolors/locales/en-US.ftl
Normal file
|
@ -0,0 +1,5 @@
|
|||
dircolors-about = Output commands to set the LS_COLORS environment variable.
|
||||
dircolors-usage = dircolors [OPTION]... [FILE]
|
||||
dircolors-after-help = If FILE is specified, read it to determine which colors to use for which
|
||||
file types and extensions. Otherwise, a precompiled database is used.
|
||||
For details on the format of these files, run 'dircolors --print-database'
|
|
@ -16,7 +16,8 @@ use clap::{Arg, ArgAction, Command};
|
|||
use uucore::colors::{FILE_ATTRIBUTE_CODES, FILE_COLORS, FILE_TYPES, TERMS};
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{UResult, USimpleError, UUsageError};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, parser::parse_glob};
|
||||
use uucore::locale::get_message;
|
||||
use uucore::{format_usage, parser::parse_glob};
|
||||
|
||||
mod options {
|
||||
pub const BOURNE_SHELL: &str = "bourne-shell";
|
||||
|
@ -26,10 +27,6 @@ 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");
|
||||
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum OutputFmt {
|
||||
Shell,
|
||||
|
@ -245,9 +242,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(
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# dirname
|
||||
|
||||
```
|
||||
dirname [OPTION] NAME...
|
||||
```
|
||||
|
||||
Strip last component from file name
|
||||
|
||||
## After Help
|
||||
|
||||
Output each NAME with its last non-slash component and trailing slashes
|
||||
removed; if NAME contains no /'s, output '.' (meaning the current directory).
|
4
src/uu/dirname/locales/en-US.ftl
Normal file
4
src/uu/dirname/locales/en-US.ftl
Normal file
|
@ -0,0 +1,4 @@
|
|||
dirname-about = Strip last component from file name
|
||||
dirname-usage = dirname [OPTION] NAME...
|
||||
dirname-after-help = Output each NAME with its last non-slash component and trailing slashes
|
||||
removed; if NAME contains no /'s, output '.' (meaning the current directory).
|
|
@ -7,12 +7,10 @@ use clap::{Arg, ArgAction, Command};
|
|||
use std::path::Path;
|
||||
use uucore::display::print_verbatim;
|
||||
use uucore::error::{UResult, UUsageError};
|
||||
use uucore::format_usage;
|
||||
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::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(
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
# du
|
||||
|
||||
```
|
||||
du [OPTION]... [FILE]...
|
||||
du [OPTION]... --files0-from=F
|
||||
```
|
||||
|
||||
Estimate file space usage
|
||||
|
||||
## After Help
|
||||
|
||||
Display values are in units of the first available SIZE from --block-size,
|
||||
and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
|
||||
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
|
||||
|
||||
SIZE is an integer and optional unit (example: 10M is 10*1024*1024).
|
||||
Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers
|
||||
of 1000).
|
||||
|
||||
PATTERN allows some advanced exclusions. For example, the following syntaxes
|
||||
are supported:
|
||||
`?` will match only one character
|
||||
`*` will match zero or more characters
|
||||
`{a,b}` will match a or b
|
16
src/uu/du/locales/en-US.ftl
Normal file
16
src/uu/du/locales/en-US.ftl
Normal file
|
@ -0,0 +1,16 @@
|
|||
du-about = Estimate file space usage
|
||||
du-usage = du [OPTION]... [FILE]...
|
||||
du [OPTION]... --files0-from=F
|
||||
du-after-help = Display values are in units of the first available SIZE from --block-size,
|
||||
and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
|
||||
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
|
||||
|
||||
SIZE is an integer and optional unit (example: 10M is 10*1024*1024).
|
||||
Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers
|
||||
of 1000).
|
||||
|
||||
PATTERN allows some advanced exclusions. For example, the following syntaxes
|
||||
are supported:
|
||||
? will match only one character
|
||||
{ "*" } will match zero or more characters
|
||||
{"{"}a,b{"}"} will match a or b
|
|
@ -27,10 +27,11 @@ use thiserror::Error;
|
|||
use uucore::display::{Quotable, print_verbatim};
|
||||
use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code};
|
||||
use uucore::line_ending::LineEnding;
|
||||
use uucore::locale::get_message;
|
||||
use uucore::parser::parse_glob;
|
||||
use uucore::parser::parse_size::{ParseSizeError, parse_size_u64};
|
||||
use uucore::parser::shortcut_value_parser::ShortcutValueParser;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show, show_error, show_warning};
|
||||
use uucore::{format_usage, show, show_error, show_warning};
|
||||
#[cfg(windows)]
|
||||
use windows_sys::Win32::Foundation::HANDLE;
|
||||
#[cfg(windows)]
|
||||
|
@ -70,10 +71,6 @@ 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");
|
||||
|
||||
struct TraversalOptions {
|
||||
all: bool,
|
||||
separate_dirs: bool,
|
||||
|
@ -824,9 +821,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(
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
# echo
|
||||
|
||||
```
|
||||
echo [OPTIONS]... [STRING]...
|
||||
```
|
||||
|
||||
Display a line of text
|
||||
|
||||
## After Help
|
||||
|
||||
Echo the STRING(s) to standard output.
|
||||
|
||||
If -e is in effect, the following sequences are recognized:
|
||||
|
||||
- `\` backslash
|
||||
- `\a` alert (BEL)
|
||||
- `\b` backspace
|
||||
- `\c` produce no further output
|
||||
- `\e` escape
|
||||
- `\f` form feed
|
||||
- `\n` new line
|
||||
- `\r` carriage return
|
||||
- `\t` horizontal tab
|
||||
- `\v` vertical tab
|
||||
- `\0NNN` byte with octal value NNN (1 to 3 digits)
|
||||
- `\xHH` byte with hexadecimal value HH (1 to 2 digits)
|
18
src/uu/echo/locales/en-US.ftl
Normal file
18
src/uu/echo/locales/en-US.ftl
Normal file
|
@ -0,0 +1,18 @@
|
|||
echo-about = Display a line of text
|
||||
echo-usage = echo [OPTIONS]... [STRING]...
|
||||
echo-after-help = Echo the STRING(s) to standard output.
|
||||
|
||||
If -e is in effect, the following sequences are recognized:
|
||||
|
||||
- \ backslash
|
||||
- \a alert (BEL)
|
||||
- \b backspace
|
||||
- \c produce no further output
|
||||
- \e escape
|
||||
- \f form feed
|
||||
- \n new line
|
||||
- \r carriage return
|
||||
- \t horizontal tab
|
||||
- \v vertical tab
|
||||
- \0NNN byte with octal value NNN (1 to 3 digits)
|
||||
- \xHH byte with hexadecimal value HH (1 to 2 digits)
|
|
@ -10,11 +10,9 @@ use std::ffi::{OsStr, OsString};
|
|||
use std::io::{self, StdoutLock, Write};
|
||||
use uucore::error::{UResult, USimpleError};
|
||||
use uucore::format::{FormatChar, OctalParsing, parse_escape_only};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
use uucore::format_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::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')
|
||||
|
|
13
src/uu/env/env.md
vendored
13
src/uu/env/env.md
vendored
|
@ -1,13 +0,0 @@
|
|||
# env
|
||||
|
||||
```
|
||||
env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
|
||||
```
|
||||
|
||||
|
||||
Set each NAME to VALUE in the environment and run COMMAND
|
||||
|
||||
|
||||
## After Help
|
||||
|
||||
A mere - implies -i. If no COMMAND, print the resulting environment.
|
3
src/uu/env/locales/en-US.ftl
vendored
Normal file
3
src/uu/env/locales/en-US.ftl
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
env-about = Set each NAME to VALUE in the environment and run COMMAND
|
||||
env-usage = env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
|
||||
env-after-help = A mere - implies -i. If no COMMAND, print the resulting environment.
|
12
src/uu/env/src/env.rs
vendored
12
src/uu/env/src/env.rs
vendored
|
@ -36,7 +36,7 @@ use uucore::error::{ExitCode, UError, UResult, USimpleError, UUsageError};
|
|||
use uucore::line_ending::LineEnding;
|
||||
#[cfg(unix)]
|
||||
use uucore::signals::signal_by_name_or_value;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show_warning};
|
||||
use uucore::{format_usage, show_warning};
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
|
@ -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::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(
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# expand
|
||||
|
||||
```
|
||||
expand [OPTION]... [FILE]...
|
||||
```
|
||||
|
||||
Convert tabs in each `FILE` to spaces, writing to standard output.
|
||||
With no `FILE`, or when `FILE` is `-`, read standard input.
|
3
src/uu/expand/locales/en-US.ftl
Normal file
3
src/uu/expand/locales/en-US.ftl
Normal file
|
@ -0,0 +1,3 @@
|
|||
expand-about = Convert tabs in each FILE to spaces, writing to standard output.
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
expand-usage = expand [OPTION]... [FILE]...
|
|
@ -16,10 +16,9 @@ use thiserror::Error;
|
|||
use unicode_width::UnicodeWidthChar;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UError, UResult, set_exit_code};
|
||||
use uucore::{format_usage, help_about, help_usage, show_error};
|
||||
use uucore::{format_usage, show_error};
|
||||
|
||||
const ABOUT: &str = help_about!("expand.md");
|
||||
const USAGE: &str = help_usage!("expand.md");
|
||||
use uucore::locale::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(
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
# expr
|
||||
|
||||
```
|
||||
expr [EXPRESSION]
|
||||
expr [OPTIONS]
|
||||
```
|
||||
|
||||
Print the value of `EXPRESSION` to standard output
|
||||
|
||||
## After help
|
||||
|
||||
Print the value of `EXPRESSION` to standard output. A blank line below
|
||||
separates increasing precedence groups.
|
||||
|
||||
`EXPRESSION` may be:
|
||||
|
||||
- `ARG1 | ARG2`: `ARG1` if it is neither null nor 0, otherwise `ARG2`
|
||||
- `ARG1 & ARG2`: `ARG1` if neither argument is null or 0, otherwise 0
|
||||
- `ARG1 < ARG2`: `ARG1` is less than `ARG2`
|
||||
- `ARG1 <= ARG2`: `ARG1` is less than or equal to `ARG2`
|
||||
- `ARG1 = ARG2`: `ARG1` is equal to `ARG2`
|
||||
- `ARG1 != ARG2`: `ARG1` is unequal to `ARG2`
|
||||
- `ARG1 >= ARG2`: `ARG1` is greater than or equal to `ARG2`
|
||||
- `ARG1 > ARG2`: `ARG1` is greater than `ARG2`
|
||||
- `ARG1 + ARG2`: arithmetic sum of `ARG1` and `ARG2`
|
||||
- `ARG1 - ARG2`: arithmetic difference of `ARG1` and `ARG2`
|
||||
- `ARG1 * ARG2`: arithmetic product of `ARG1` and `ARG2`
|
||||
- `ARG1 / ARG2`: arithmetic quotient of `ARG1` divided by `ARG2`
|
||||
- `ARG1 % ARG2`: arithmetic remainder of `ARG1` divided by `ARG2`
|
||||
- `STRING : REGEXP`: anchored pattern match of `REGEXP` in `STRING`
|
||||
- `match STRING REGEXP`: same as `STRING : REGEXP`
|
||||
- `substr STRING POS LENGTH`: substring of `STRING`, `POS` counted from 1
|
||||
- `index STRING CHARS`: index in `STRING` where any `CHARS` is found, or 0
|
||||
- `length STRING`: length of `STRING`
|
||||
- `+ TOKEN`: interpret `TOKEN` as a string, even if it is a keyword like `match`
|
||||
or an operator like `/`
|
||||
- `( EXPRESSION )`: value of `EXPRESSION`
|
||||
|
||||
Beware that many operators need to be escaped or quoted for shells.
|
||||
Comparisons are arithmetic if both ARGs are numbers, else lexicographical.
|
||||
Pattern matches return the string matched between \( and \) or null; if
|
||||
\( and \) are not used, they return the number of characters matched or 0.
|
||||
|
||||
Exit status is `0` if `EXPRESSION` is neither null nor `0`, `1` if `EXPRESSION`
|
||||
is null or `0`, `2` if `EXPRESSION` is syntactically invalid, and `3` if an
|
||||
error occurred.
|
||||
|
||||
Environment variables:
|
||||
|
||||
- `EXPR_DEBUG_TOKENS=1`: dump expression's tokens
|
||||
- `EXPR_DEBUG_RPN=1`: dump expression represented in reverse polish notation
|
||||
- `EXPR_DEBUG_SYA_STEP=1`: dump each parser step
|
||||
- `EXPR_DEBUG_AST=1`: dump expression represented abstract syntax tree
|
45
src/uu/expr/locales/en-US.ftl
Normal file
45
src/uu/expr/locales/en-US.ftl
Normal file
|
@ -0,0 +1,45 @@
|
|||
expr-about = Print the value of EXPRESSION to standard output
|
||||
expr-usage = expr [EXPRESSION]
|
||||
expr [OPTIONS]
|
||||
expr-after-help = Print the value of EXPRESSION to standard output. A blank line below
|
||||
separates increasing precedence groups.
|
||||
|
||||
EXPRESSION may be:
|
||||
|
||||
- ARG1 | ARG2: ARG1 if it is neither null nor 0, otherwise ARG2
|
||||
- ARG1 & ARG2: ARG1 if neither argument is null or 0, otherwise 0
|
||||
- ARG1 < ARG2: ARG1 is less than ARG2
|
||||
- ARG1 <= ARG2: ARG1 is less than or equal to ARG2
|
||||
- ARG1 = ARG2: ARG1 is equal to ARG2
|
||||
- ARG1 != ARG2: ARG1 is unequal to ARG2
|
||||
- ARG1 >= ARG2: ARG1 is greater than or equal to ARG2
|
||||
- ARG1 > ARG2: ARG1 is greater than ARG2
|
||||
- ARG1 + ARG2: arithmetic sum of ARG1 and ARG2
|
||||
- ARG1 - ARG2: arithmetic difference of ARG1 and ARG2
|
||||
- ARG1 * ARG2: arithmetic product of ARG1 and ARG2
|
||||
- ARG1 / ARG2: arithmetic quotient of ARG1 divided by ARG2
|
||||
- ARG1 % ARG2: arithmetic remainder of ARG1 divided by ARG2
|
||||
- STRING : REGEXP: anchored pattern match of REGEXP in STRING
|
||||
- match STRING REGEXP: same as STRING : REGEXP
|
||||
- substr STRING POS LENGTH: substring of STRING, POS counted from 1
|
||||
- index STRING CHARS: index in STRING where any CHARS is found, or 0
|
||||
- length STRING: length of STRING
|
||||
- + TOKEN: interpret TOKEN as a string, even if it is a keyword like match
|
||||
or an operator like /
|
||||
- ( EXPRESSION ): value of EXPRESSION
|
||||
|
||||
Beware that many operators need to be escaped or quoted for shells.
|
||||
Comparisons are arithmetic if both ARGs are numbers, else lexicographical.
|
||||
Pattern matches return the string matched between \( and \) or null; if
|
||||
\( and \) are not used, they return the number of characters matched or 0.
|
||||
|
||||
Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION
|
||||
is null or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an
|
||||
error occurred.
|
||||
|
||||
Environment variables:
|
||||
|
||||
- EXPR_DEBUG_TOKENS=1: dump expression's tokens
|
||||
- EXPR_DEBUG_RPN=1: dump expression represented in reverse polish notation
|
||||
- EXPR_DEBUG_SYA_STEP=1: dump each parser step
|
||||
- EXPR_DEBUG_AST=1: dump expression represented abstract syntax tree
|
|
@ -6,10 +6,11 @@
|
|||
use clap::{Arg, ArgAction, Command};
|
||||
use syntax_tree::{AstNode, is_truthy};
|
||||
use thiserror::Error;
|
||||
use uucore::locale::get_message;
|
||||
use uucore::{
|
||||
display::Quotable,
|
||||
error::{UError, UResult},
|
||||
format_usage, help_about, help_section, help_usage,
|
||||
format_usage,
|
||||
};
|
||||
|
||||
mod syntax_tree;
|
||||
|
@ -67,9 +68,9 @@ impl UError for ExprError {
|
|||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(uucore::crate_version!())
|
||||
.about(help_about!("expr.md"))
|
||||
.override_usage(format_usage(help_usage!("expr.md")))
|
||||
.after_help(help_section!("after help", "expr.md"))
|
||||
.about(get_message("expr-about"))
|
||||
.override_usage(format_usage(&get_message("expr-usage")))
|
||||
.after_help(get_message("expr-after-help"))
|
||||
.infer_long_args(true)
|
||||
.disable_help_flag(true)
|
||||
.disable_version_flag(true)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# factor
|
||||
|
||||
```
|
||||
factor [OPTION]... [NUMBER]...
|
||||
```
|
||||
|
||||
Print the prime factors of the given NUMBER(s).
|
||||
If none are specified, read from standard input.
|
3
src/uu/factor/locales/en-US.ftl
Normal file
3
src/uu/factor/locales/en-US.ftl
Normal file
|
@ -0,0 +1,3 @@
|
|||
factor-about = Print the prime factors of the given NUMBER(s).
|
||||
If none are specified, read from standard input.
|
||||
factor-usage = factor [OPTION]... [NUMBER]...
|
|
@ -14,10 +14,9 @@ use num_bigint::BigUint;
|
|||
use num_traits::FromPrimitive;
|
||||
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};
|
||||
use uucore::{format_usage, show_error, show_warning};
|
||||
|
||||
const ABOUT: &str = help_about!("factor.md");
|
||||
const USAGE: &str = help_usage!("factor.md");
|
||||
use uucore::locale::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)
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# false
|
||||
|
||||
```
|
||||
false
|
||||
```
|
||||
|
||||
Returns false, an unsuccessful exit status.
|
||||
|
||||
Immediately returns with the exit status `1`. When invoked with one of the recognized options it
|
||||
will try to write the help or version text. Any IO error during this operation is diagnosed, yet
|
||||
the program will also return `1`.
|
5
src/uu/false/locales/en-US.ftl
Normal file
5
src/uu/false/locales/en-US.ftl
Normal file
|
@ -0,0 +1,5 @@
|
|||
false-about = Returns false, an unsuccessful exit status.
|
||||
|
||||
Immediately returns with the exit status 1. When invoked with one of the recognized options it
|
||||
will try to write the help or version text. Any IO error during this operation is diagnosed, yet
|
||||
the program will also return 1.
|
|
@ -5,9 +5,8 @@
|
|||
use clap::{Arg, ArgAction, Command};
|
||||
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::get_message;
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
|
@ -46,7 +45,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)
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# fmt
|
||||
|
||||
```
|
||||
fmt [-WIDTH] [OPTION]... [FILE]...
|
||||
```
|
||||
|
||||
Reformat paragraphs from input files (or stdin) to stdout.
|
2
src/uu/fmt/locales/en-US.ftl
Normal file
2
src/uu/fmt/locales/en-US.ftl
Normal file
|
@ -0,0 +1,2 @@
|
|||
fmt-about = Reformat paragraphs from input files (or stdin) to stdout.
|
||||
fmt-usage = fmt [-WIDTH] [OPTION]... [FILE]...
|
|
@ -10,16 +10,15 @@ use std::fs::File;
|
|||
use std::io::{BufReader, BufWriter, Read, Stdout, Write, stdin, stdout};
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
use uucore::format_usage;
|
||||
|
||||
use linebreak::break_lines;
|
||||
use parasplit::ParagraphStream;
|
||||
use uucore::locale::get_message;
|
||||
|
||||
mod linebreak;
|
||||
mod parasplit;
|
||||
|
||||
const ABOUT: &str = help_about!("fmt.md");
|
||||
const USAGE: &str = help_usage!("fmt.md");
|
||||
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(
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# fold
|
||||
|
||||
```
|
||||
fold [OPTION]... [FILE]...
|
||||
```
|
||||
|
||||
Writes each file (or standard input if no files are given)
|
||||
to standard output whilst breaking long lines
|
3
src/uu/fold/locales/en-US.ftl
Normal file
3
src/uu/fold/locales/en-US.ftl
Normal file
|
@ -0,0 +1,3 @@
|
|||
fold-about = Writes each file (or standard input if no files are given)
|
||||
to standard output whilst breaking long lines
|
||||
fold-usage = fold [OPTION]... [FILE]...
|
|
@ -11,13 +11,11 @@ use std::io::{BufRead, BufReader, Read, stdin};
|
|||
use std::path::Path;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
use uucore::format_usage;
|
||||
use uucore::locale::get_message;
|
||||
|
||||
const TAB_WIDTH: usize = 8;
|
||||
|
||||
const USAGE: &str = help_usage!("fold.md");
|
||||
const ABOUT: &str = help_about!("fold.md");
|
||||
|
||||
mod options {
|
||||
pub const BYTES: &str = "bytes";
|
||||
pub const SPACES: &str = "spaces";
|
||||
|
@ -60,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("fold-usage")))
|
||||
.about(get_message("fold-about"))
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::BYTES)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# groups
|
||||
|
||||
```
|
||||
groups [OPTION]... [USERNAME]...
|
||||
```
|
||||
|
||||
Print group memberships for each `USERNAME` or, if no `USERNAME` is specified, for
|
||||
the current process (which may differ if the groups data‐base has changed).
|
3
src/uu/groups/locales/en-US.ftl
Normal file
3
src/uu/groups/locales/en-US.ftl
Normal file
|
@ -0,0 +1,3 @@
|
|||
groups-about = Print group memberships for each USERNAME or, if no USERNAME is specified, for
|
||||
the current process (which may differ if the groups data‐base has changed).
|
||||
groups-usage = groups [OPTION]... [USERNAME]...
|
|
@ -10,16 +10,15 @@ use uucore::{
|
|||
display::Quotable,
|
||||
entries::{Locate, Passwd, get_groups_gnu, gid2grp},
|
||||
error::{UError, UResult},
|
||||
format_usage, help_about, help_usage, show,
|
||||
format_usage, show,
|
||||
};
|
||||
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
use uucore::locale::get_message;
|
||||
|
||||
mod options {
|
||||
pub const USERS: &str = "USERNAME";
|
||||
}
|
||||
const ABOUT: &str = help_about!("groups.md");
|
||||
const USAGE: &str = help_usage!("groups.md");
|
||||
|
||||
#[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)
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# hashsum
|
||||
|
||||
```
|
||||
hashsum --<digest> [OPTIONS]... [FILE]...
|
||||
```
|
||||
|
||||
Compute and check message digests.
|
2
src/uu/hashsum/locales/en-US.ftl
Normal file
2
src/uu/hashsum/locales/en-US.ftl
Normal file
|
@ -0,0 +1,2 @@
|
|||
hashsum-about = Compute and check message digests.
|
||||
hashsum-usage = hashsum --<digest> [OPTIONS]... [FILE]...
|
|
@ -26,12 +26,11 @@ use uucore::checksum::digest_reader;
|
|||
use uucore::checksum::escape_filename;
|
||||
use uucore::checksum::perform_checksum_validation;
|
||||
use uucore::error::{FromIo, UResult};
|
||||
use uucore::format_usage;
|
||||
use uucore::locale::get_message;
|
||||
use uucore::sum::{Digest, Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256};
|
||||
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");
|
||||
|
||||
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(
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# head
|
||||
|
||||
```
|
||||
head [FLAG]... [FILE]...
|
||||
```
|
||||
|
||||
Print the first 10 lines of each `FILE` to standard output.
|
||||
With more than one `FILE`, precede each with a header giving the file name.
|
||||
With no `FILE`, or when `FILE` is `-`, read standard input.
|
||||
|
||||
Mandatory arguments to long flags are mandatory for short flags too.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue