mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
refactor ~ usage()
instead of get_usage()
This commit is contained in:
parent
894d9a068c
commit
23b68d80ba
59 changed files with 122 additions and 121 deletions
|
@ -28,13 +28,13 @@ static VERSION: &str = env!("CARGO_PKG_VERSION");
|
|||
|
||||
static BASE_CMD_PARSE_ERROR: i32 = 1;
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let format = Format::Base32;
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let name = executable!();
|
||||
|
||||
let config_result: Result<base_common::Config, String> =
|
||||
|
|
|
@ -29,13 +29,13 @@ static VERSION: &str = env!("CARGO_PKG_VERSION");
|
|||
|
||||
static BASE_CMD_PARSE_ERROR: i32 = 1;
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let format = Format::Base64;
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let name = executable!();
|
||||
let config_result: Result<base_common::Config, String> =
|
||||
base_common::parse_base_cmd_args(args, name, VERSION, ABOUT, &usage);
|
||||
|
|
|
@ -17,7 +17,7 @@ use uucore::InvalidEncodingHandling;
|
|||
static SUMMARY: &str = "Print NAME with any leading directory components removed
|
||||
If specified, also remove a trailing SUFFIX";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} NAME [SUFFIX]
|
||||
{0} OPTION... NAME...",
|
||||
|
@ -36,7 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
//
|
||||
// Argument parsing
|
||||
//
|
||||
|
|
|
@ -59,7 +59,7 @@ const FTS_COMFOLLOW: u8 = 1;
|
|||
const FTS_PHYSICAL: u8 = 1 << 1;
|
||||
const FTS_LOGICAL: u8 = 1 << 2;
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... GROUP FILE...\n {0} [OPTION]... --reference=RFILE FILE...",
|
||||
executable!()
|
||||
|
@ -71,7 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let mut app = uu_app().usage(&usage[..]);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ mod options {
|
|||
pub const FILE: &str = "FILE";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... MODE[,MODE]... FILE...
|
||||
or: {0} [OPTION]... OCTAL-MODE FILE...
|
||||
|
@ -58,7 +58,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
// a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE").
|
||||
let mode_had_minus_prefix = strip_minus_from_mode(&mut args);
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let after_help = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -61,7 +61,7 @@ const FTS_COMFOLLOW: u8 = 1;
|
|||
const FTS_PHYSICAL: u8 = 1 << 1;
|
||||
const FTS_LOGICAL: u8 = 1 << 2;
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... [OWNER][:[GROUP]] FILE...\n{0} [OPTION]... --reference=RFILE FILE...",
|
||||
executable!()
|
||||
|
@ -74,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ mod options {
|
|||
pub const FILE_2: &str = "FILE2";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{} [OPTION]... FILE1 FILE2", executable!())
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ fn open_file(name: &str) -> io::Result<LineReader> {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
|
|
@ -218,7 +218,7 @@ static LONG_HELP: &str = "";
|
|||
static EXIT_OK: i32 = 0;
|
||||
static EXIT_ERR: i32 = 1;
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... [-T] SOURCE DEST
|
||||
{0} [OPTION]... SOURCE... DIRECTORY
|
||||
|
@ -465,7 +465,7 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app()
|
||||
.after_help(&*format!(
|
||||
"{}\n{}",
|
||||
|
|
|
@ -34,7 +34,7 @@ mod options {
|
|||
pub const PATTERN: &str = "pattern";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... FILE PATTERN...", executable!())
|
||||
}
|
||||
|
||||
|
@ -706,7 +706,7 @@ mod tests {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
|
|
@ -79,7 +79,7 @@ struct Filesystem {
|
|||
usage: FsUsage,
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ impl UError for DfError {
|
|||
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
let paths: Vec<String> = matches
|
||||
|
|
|
@ -62,7 +62,7 @@ pub fn guess_syntax() -> OutputFmt {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} {1}", executable!(), SYNTAX)
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(&args);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ mod options {
|
|||
pub const DIR: &str = "dir";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION] NAME...", executable!())
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let after_help = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -392,7 +392,7 @@ fn convert_size_other(size: u64, _multiplier: u64, block_size: u64) -> String {
|
|||
format!("{}", ((size as f64) / (block_size as f64)).ceil())
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... [FILE]...
|
||||
{0} [OPTION]... --files0-from=F",
|
||||
|
@ -456,7 +456,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ static LONG_HELP: &str = "";
|
|||
|
||||
static DEFAULT_TABSTOP: usize = 8;
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ impl Options {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
expand(Options::new(&matches));
|
||||
|
|
|
@ -50,7 +50,7 @@ static OPT_TAB_WIDTH: &str = "tab-width";
|
|||
|
||||
static ARG_FILES: &str = "files";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{} [OPTION]... [FILE]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ pub struct FmtOptions {
|
|||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@ static ABOUT: &str = "Print group memberships for each USERNAME or, \
|
|||
if no USERNAME is specified, for\nthe current process \
|
||||
(which may differ if the groups data‐base has changed).";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [USERNAME]...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -53,11 +53,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
result
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [HOSTNAME]", executable!())
|
||||
}
|
||||
|
||||
fn execute(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
match matches.value_of(OPT_HOST) {
|
||||
|
|
|
@ -76,7 +76,7 @@ mod options {
|
|||
pub const ARG_USERS: &str = "USER";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [USER]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ struct State {
|
|||
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let after_help = get_description();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -172,7 +172,7 @@ static OPT_CONTEXT: &str = "context";
|
|||
|
||||
static ARG_FILES: &str = "files";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ fn get_usage() -> String {
|
|||
///
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ pub mod options {
|
|||
pub static FILES: &str = "FILES";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} FILE1 FILE2", executable!())
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ pub fn normalize_error_message(e: Error) -> String {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
let files: Vec<_> = matches
|
||||
|
|
|
@ -92,7 +92,7 @@ impl UError for LnError {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... [-T] TARGET LINK_NAME (1st form)
|
||||
{0} [OPTION]... TARGET (2nd form)
|
||||
|
@ -102,7 +102,7 @@ fn get_usage() -> String {
|
|||
)
|
||||
}
|
||||
|
||||
fn get_long_usage() -> String {
|
||||
fn long_usage() -> String {
|
||||
String::from(
|
||||
" In the 1st form, create a link to TARGET with the name LINK_NAME.
|
||||
In the 2nd form, create a link to TARGET in the current directory.
|
||||
|
@ -136,8 +136,8 @@ static ARG_FILES: &str = "files";
|
|||
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let long_usage = get_long_usage();
|
||||
let usage = usage();
|
||||
let long_usage = long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
.usage(&usage[..])
|
||||
|
|
|
@ -35,7 +35,7 @@ fn get_userlogin() -> Option<String> {
|
|||
|
||||
static SUMMARY: &str = "Print user's login name";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
String::from(executable!())
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let _ = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
match get_userlogin() {
|
||||
|
|
|
@ -46,7 +46,7 @@ use unicode_width::UnicodeWidthStr;
|
|||
use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR};
|
||||
use uucore::{fs::display_permissions, version_cmp::version_cmp};
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let app = uu_app().usage(&usage[..]);
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ mod options {
|
|||
pub const DIRS: &str = "dirs";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [USER]", executable!())
|
||||
}
|
||||
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
// Linux-specific options, not implemented
|
||||
// opts.optflag("Z", "context", "set SELinux security context" +
|
||||
|
|
|
@ -36,7 +36,7 @@ static OPT_T: &str = "t";
|
|||
|
||||
static ARG_TEMPLATE: &str = "template";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [TEMPLATE]", executable!())
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ impl Display for MkTempError {
|
|||
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static OPT_VERBOSE: &str = "verbose";
|
|||
|
||||
static ARG_FILES: &str = "files";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... [-T] SOURCE DEST
|
||||
{0} [OPTION]... SOURCE... DIRECTORY
|
||||
|
@ -68,7 +68,7 @@ fn get_usage() -> String {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app()
|
||||
.after_help(&*format!(
|
||||
|
|
|
@ -22,7 +22,7 @@ pub mod options {
|
|||
pub static COMMAND: &str = "COMMAND";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"
|
||||
{0} [OPTIONS] [COMMAND [ARGS]]
|
||||
|
@ -36,7 +36,7 @@ process).",
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ mod options {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
@ -156,7 +156,7 @@ fn find_stdout() -> File {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} COMMAND [ARG]...\n {0} FLAG", executable!())
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ static OPT_IGNORE: &str = "ignore";
|
|||
|
||||
static ABOUT: &str = "Print the number of cores available to the current process.";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTIONS]...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
let mut ignore = match matches.value_of(OPT_IGNORE) {
|
||||
|
|
|
@ -50,7 +50,7 @@ FIELDS supports cut(1) style field ranges:
|
|||
Multiple fields/ranges can be separated with commas
|
||||
";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [NUMBER]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ fn parse_options(args: &ArgMatches) -> Result<NumfmtOptions> {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -39,12 +39,12 @@ mod options {
|
|||
const POSIX_PATH_MAX: usize = 256;
|
||||
const POSIX_NAME_MAX: usize = 14;
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... NAME...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
|
|
@ -40,7 +40,7 @@ mod options {
|
|||
pub const USER: &str = "user";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [USER]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let after_help = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -19,12 +19,12 @@ static OPT_NULL: &str = "null";
|
|||
|
||||
static ARG_VARIABLES: &str = "variables";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [VARIABLE]... [OPTION]...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -34,13 +34,13 @@ pub fn absolute_path(path: &Path) -> io::Result<PathBuf> {
|
|||
Ok(path_buf)
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... FILE...", executable!())
|
||||
}
|
||||
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -29,12 +29,12 @@ const OPT_ZERO: &str = "zero";
|
|||
|
||||
const ARG_FILES: &str = "files";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
let mut no_newline = matches.is_present(OPT_NO_NEWLINE);
|
||||
|
|
|
@ -22,12 +22,12 @@ static OPT_ZERO: &str = "zero";
|
|||
|
||||
static ARG_FILES: &str = "files";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... FILE...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ mod options {
|
|||
pub const FROM: &str = "FROM";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{} [-d DIR] TO [FROM]", executable!())
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ static OPT_VERBOSE: &str = "verbose";
|
|||
|
||||
static ARG_FILES: &str = "files";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... FILE...", executable!())
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ fn get_long_usage() -> String {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let long_usage = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -26,12 +26,12 @@ static ENOTDIR: i32 = 20;
|
|||
#[cfg(windows)]
|
||||
static ENOTDIR: i32 = 267;
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... DIRECTORY...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ static OPT_WIDTHS: &str = "widths";
|
|||
|
||||
static ARG_NUMBERS: &str = "numbers";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... LAST
|
||||
{0} [OPTION]... FIRST LAST
|
||||
|
@ -86,7 +86,7 @@ impl FromStr for Number {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
let numbers = matches.values_of(ARG_NUMBERS).unwrap().collect::<Vec<_>>();
|
||||
|
|
|
@ -213,7 +213,7 @@ static ABOUT: &str = "Overwrite the specified FILE(s) repeatedly, in order to ma
|
|||
for even very expensive hardware probing to recover the data.
|
||||
";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{} [OPTION]... FILE...", executable!())
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let app = uu_app().usage(&usage[..]);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ mod options {
|
|||
pub const NUMBER: &str = "NUMBER";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} {1}[SUFFIX]... \n {0} OPTION",
|
||||
executable!(),
|
||||
|
@ -36,7 +36,7 @@ fn get_usage() -> String {
|
|||
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -1055,7 +1055,7 @@ impl FieldSelector {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... [FILE]...
|
||||
Write the sorted concatenation of all FILE(s) to standard output.
|
||||
|
@ -1081,7 +1081,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let mut settings: GlobalSettings = Default::default();
|
||||
|
||||
let matches = match uu_app().usage(&usage[..]).get_matches_from_safe(args) {
|
||||
|
|
|
@ -36,7 +36,7 @@ static OPT_VERBOSE: &str = "verbose";
|
|||
static ARG_INPUT: &str = "input";
|
||||
static ARG_PREFIX: &str = "prefix";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [INPUT [PREFIX]]", NAME)
|
||||
}
|
||||
fn get_long_usage() -> String {
|
||||
|
@ -47,12 +47,12 @@ fn get_long_usage() -> String {
|
|||
Output fixed-size pieces of INPUT to PREFIXaa, PREFIX ab, ...; default
|
||||
size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is
|
||||
-, read standard input.",
|
||||
get_usage()
|
||||
usage()
|
||||
)
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let long_usage = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -882,7 +882,7 @@ impl Stater {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... FILE...", executable!())
|
||||
}
|
||||
|
||||
|
@ -945,7 +945,7 @@ for details about the options it supports.
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let long_usage = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -47,7 +47,7 @@ mod options {
|
|||
pub const COMMAND: &str = "command";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} OPTION... COMMAND", executable!())
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -159,12 +159,12 @@ mod platform {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... FILE...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ struct Options {
|
|||
files: Vec<String>,
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ use uucore::InvalidEncodingHandling;
|
|||
|
||||
static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION.";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION] DURATION COMMAND...", executable!())
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let app = uu_app().usage(&usage[..]);
|
||||
|
||||
|
|
|
@ -47,13 +47,13 @@ fn local_tm_to_filetime(tm: time::Tm) -> FileTime {
|
|||
FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32)
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [USER]", executable!())
|
||||
}
|
||||
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ fn translate_input<T: SymbolTranslator>(
|
|||
}
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{} [OPTION]... SET1 [SET2]", executable!())
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let after_help = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -63,7 +63,7 @@ pub mod options {
|
|||
pub static ARG_FILES: &str = "files";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [FILE]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ fn get_long_usage() -> String {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let long_usage = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -23,12 +23,12 @@ mod options {
|
|||
pub const SILENT: &str = "silent";
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
|
|
@ -221,7 +221,7 @@ fn opt_parsed<T: FromStr>(opt_name: &str, matches: &ArgMatches) -> Option<T> {
|
|||
})
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [INPUT [OUTPUT]]...", executable!())
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ fn get_long_usage() -> String {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let long_usage = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -22,7 +22,7 @@ use uucore::InvalidEncodingHandling;
|
|||
static ABOUT: &str = "Unlink the file at [FILE].";
|
||||
static OPT_PATH: &str = "FILE";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{} [OPTION]... FILE", executable!())
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ extern "C" {
|
|||
fn GetTickCount() -> uucore::libc::uint32_t;
|
||||
}
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]...", executable!())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
let (boot_time, user_count) = process_utmpx();
|
||||
|
|
|
@ -18,7 +18,7 @@ static ABOUT: &str = "Print the user names of users currently logged in to the c
|
|||
|
||||
static ARG_FILES: &str = "files";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [FILE]", executable!())
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ If FILE is not specified, use {}. /var/log/wtmp as FILE is common.",
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let after_help = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
|
@ -95,7 +95,7 @@ pub mod options {
|
|||
|
||||
static ARG_FILES: &str = "files";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
"{0} [OPTION]... [FILE]...
|
||||
With no FILE, or when FILE is -, read standard input.",
|
||||
|
@ -132,7 +132,7 @@ impl Input {
|
|||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ static RUNLEVEL_HELP: &str = "print current runlevel";
|
|||
#[cfg(not(target_os = "linux"))]
|
||||
static RUNLEVEL_HELP: &str = "print current runlevel (This is meaningless on non Linux)";
|
||||
|
||||
fn get_usage() -> String {
|
||||
fn usage() -> String {
|
||||
format!("{0} [OPTION]... [ FILE | ARG1 ARG2 ]", executable!())
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.collect_str(InvalidEncodingHandling::Ignore)
|
||||
.accept_any();
|
||||
|
||||
let usage = get_usage();
|
||||
let usage = usage();
|
||||
let after_help = get_long_usage();
|
||||
|
||||
let matches = uu_app()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue