mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 05:57:46 +00:00
Standardize display of utility name and version.
This commit is contained in:
parent
a1017a24dd
commit
28e00cbd78
26 changed files with 56 additions and 55 deletions
|
@ -48,7 +48,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
Err(f) => { crash!(1, "{}", f) }
|
Err(f) => { crash!(1, "{}", f) }
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
let msg = format!("{name} v{version}
|
let msg = format!("{name} {version}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{program} [OPTION]... MODE[,MODE]... FILE...
|
{program} [OPTION]... MODE[,MODE]... FILE...
|
||||||
|
@ -63,7 +63,7 @@ Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'.",
|
||||||
print!("{}", opts.usage(&msg));
|
print!("{}", opts.usage(&msg));
|
||||||
return 0;
|
return 0;
|
||||||
} else if matches.opt_present("version") {
|
} else if matches.opt_present("version") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
} else if matches.free.is_empty() && matches.opt_present("reference") || matches.free.len() < 2 {
|
} else if matches.free.is_empty() && matches.opt_present("reference") || matches.free.len() < 2 {
|
||||||
show_error!("missing an argument");
|
show_error!("missing an argument");
|
||||||
show_error!("for help, try '{} --help'", NAME);
|
show_error!("for help, try '{} --help'", NAME);
|
||||||
|
|
|
@ -202,11 +202,11 @@ fn set_user(user: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version() {
|
fn version() {
|
||||||
println!("{} v{}", NAME, VERSION)
|
println!("{} {}", NAME, VERSION)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn help_menu(options: Options) {
|
fn help_menu(options: Options) {
|
||||||
let msg = format!("{0} v{1}
|
let msg = format!("{0} {1}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{0} [OPTION]... NEWROOT [COMMAND [ARG]...]
|
{0} [OPTION]... NEWROOT [COMMAND [ARG]...]
|
||||||
|
|
|
@ -210,7 +210,7 @@ ers of 1000).",
|
||||||
usage = opts.usage("Summarize disk usage of each FILE, recursively for directories."));
|
usage = opts.usage("Summarize disk usage of each FILE, recursively for directories."));
|
||||||
return 0;
|
return 0;
|
||||||
} else if matches.opt_present("version") {
|
} else if matches.opt_present("version") {
|
||||||
println!("{} version: {}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
27
src/env/env.rs
vendored
27
src/env/env.rs
vendored
|
@ -21,6 +21,9 @@ use std::process::Command;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
|
static NAME: &'static str = "env";
|
||||||
|
static VERSION: &'static str = "1.0.0";
|
||||||
|
|
||||||
struct options {
|
struct options {
|
||||||
ignore_env: bool,
|
ignore_env: bool,
|
||||||
null: bool,
|
null: bool,
|
||||||
|
@ -29,8 +32,8 @@ struct options {
|
||||||
program: Vec<String>
|
program: Vec<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(prog: &str) {
|
fn usage() {
|
||||||
println!("Usage: {} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]", prog);
|
println!("Usage: {} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]", NAME);
|
||||||
println!("Set each NAME to VALUE in the environment and run COMMAND\n");
|
println!("Set each NAME to VALUE in the environment and run COMMAND\n");
|
||||||
println!("Possible options are:");
|
println!("Possible options are:");
|
||||||
println!(" -i --ignore-environment\t start with an empty environment");
|
println!(" -i --ignore-environment\t start with an empty environment");
|
||||||
|
@ -42,7 +45,7 @@ fn usage(prog: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version() {
|
fn version() {
|
||||||
println!("env 1.0.0");
|
println!("{} {}", NAME, VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// print name=value env pairs on screen
|
// print name=value env pairs on screen
|
||||||
|
@ -54,8 +57,6 @@ fn print_env(null: bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uumain(args: Vec<String>) -> i32 {
|
pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
let prog = &args[0];
|
|
||||||
|
|
||||||
// to handle arguments the same way than GNU env, we can't use getopts
|
// to handle arguments the same way than GNU env, we can't use getopts
|
||||||
let mut opts = Box::new(options {
|
let mut opts = Box::new(options {
|
||||||
ignore_env: false,
|
ignore_env: false,
|
||||||
|
@ -94,7 +95,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
} else if opt.starts_with("--") {
|
} else if opt.starts_with("--") {
|
||||||
match opt.as_ref() {
|
match opt.as_ref() {
|
||||||
"--help" => { usage(prog); return 0; }
|
"--help" => { usage(); return 0; }
|
||||||
"--version" => { version(); return 0; }
|
"--version" => { version(); return 0; }
|
||||||
|
|
||||||
"--ignore-environment" => opts.ignore_env = true,
|
"--ignore-environment" => opts.ignore_env = true,
|
||||||
|
@ -103,14 +104,14 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
let var = iter.next();
|
let var = iter.next();
|
||||||
|
|
||||||
match var {
|
match var {
|
||||||
None => println!("{}: this option requires an argument: {}", prog, opt),
|
None => println!("{}: this option requires an argument: {}", NAME, opt),
|
||||||
Some(s) => opts.unsets.push(s.to_string())
|
Some(s) => opts.unsets.push(s.to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
println!("{}: invalid option \"{}\"", prog, *opt);
|
println!("{}: invalid option \"{}\"", NAME, *opt);
|
||||||
println!("Type \"{} --help\" for detailed informations", prog);
|
println!("Type \"{} --help\" for detailed informations", NAME);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
for c in chars {
|
for c in chars {
|
||||||
// short versions of options
|
// short versions of options
|
||||||
match c {
|
match c {
|
||||||
'h' => { usage(prog); return 0; }
|
'h' => { usage(); return 0; }
|
||||||
'V' => { version(); return 0; }
|
'V' => { version(); return 0; }
|
||||||
'i' => opts.ignore_env = true,
|
'i' => opts.ignore_env = true,
|
||||||
'0' => opts.null = true,
|
'0' => opts.null = true,
|
||||||
|
@ -136,13 +137,13 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
let var = iter.next();
|
let var = iter.next();
|
||||||
|
|
||||||
match var {
|
match var {
|
||||||
None => println!("{}: this option requires an argument: {}", prog, opt),
|
None => println!("{}: this option requires an argument: {}", NAME, opt),
|
||||||
Some(s) => opts.unsets.push(s.to_string())
|
Some(s) => opts.unsets.push(s.to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
println!("{}: illegal option -- {}", prog, c);
|
println!("{}: illegal option -- {}", NAME, c);
|
||||||
println!("Type \"{} --help\" for detailed informations", prog);
|
println!("Type \"{} --help\" for detailed informations", NAME);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.opt_present("V") {
|
if matches.opt_present("V") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.opt_present("V") || matches.opt_present("h") {
|
if matches.opt_present("V") || matches.opt_present("h") {
|
||||||
println!("uutils {} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,14 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("h") {
|
if matches.opt_present("h") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
println!("");
|
println!("");
|
||||||
println!("Usage:");
|
println!("Usage:");
|
||||||
println!(" {} [OPTION]... [FILE]...", NAME);
|
println!(" {} [OPTION]... [FILE]...", NAME);
|
||||||
println!("");
|
println!("");
|
||||||
print!("{}", opts.usage("Writes each file (or standard input if no files are given) to standard output whilst breaking long lines"));
|
print!("{}", opts.usage("Writes each file (or standard input if no files are given) to standard output whilst breaking long lines"));
|
||||||
} else if matches.opt_present("V") {
|
} else if matches.opt_present("V") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
} else {
|
} else {
|
||||||
let bytes = matches.opt_present("b");
|
let bytes = matches.opt_present("b");
|
||||||
let spaces = matches.opt_present("s");
|
let spaces = matches.opt_present("s");
|
||||||
|
|
|
@ -34,9 +34,9 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
} else if matches.opt_present("help") {
|
} else if matches.opt_present("help") {
|
||||||
let msg = format!("{0} v{1}
|
let msg = format!("{0} {1}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{0} [OPTION]... [USER]...
|
{0} [OPTION]... [USER]...
|
||||||
|
|
|
@ -138,7 +138,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version() {
|
fn version() {
|
||||||
pipe_println!("{} v{}", NAME, VERSION);
|
pipe_println!("{} {}", NAME, VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(program: &str, binary_name: &str, opts: &getopts::Options) {
|
fn usage(program: &str, binary_name: &str, opts: &getopts::Options) {
|
||||||
|
@ -148,7 +148,7 @@ fn usage(program: &str, binary_name: &str, opts: &getopts::Options) {
|
||||||
format!(" {} {{--md5|--sha1|--sha224|--sha256|--sha384|--sha512}} [OPTION]... [FILE]...", program)
|
format!(" {} {{--md5|--sha1|--sha224|--sha256|--sha384|--sha512}} [OPTION]... [FILE]...", program)
|
||||||
};
|
};
|
||||||
|
|
||||||
let msg = format!("{} v{}
|
let msg = format!("{} {}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -179,5 +179,5 @@ fn head<T: Read>(reader: &mut BufReader<T>, count: usize, use_bytes: bool) -> bo
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version() {
|
fn version() {
|
||||||
println!("{} version {}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
let verbose = matches.opt_present("verbose");
|
let verbose = matches.opt_present("verbose");
|
||||||
|
@ -79,7 +79,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_help(opts: &getopts::Options) {
|
fn print_help(opts: &getopts::Options) {
|
||||||
println!("{} v{} - make a new directory with the given path", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
println!("");
|
println!("");
|
||||||
println!("Usage:");
|
println!("Usage:");
|
||||||
print!("{}", opts.usage("Create the given DIRECTORY(ies) if they do not exist"));
|
print!("{}", opts.usage("Create the given DIRECTORY(ies) if they do not exist"));
|
||||||
|
|
10
src/mv/mv.rs
10
src/mv/mv.rs
|
@ -106,7 +106,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
"none" | "off" => BackupMode::NoBackup,
|
"none" | "off" => BackupMode::NoBackup,
|
||||||
x => {
|
x => {
|
||||||
show_error!("invalid argument ‘{}’ for ‘backup type’\n\
|
show_error!("invalid argument ‘{}’ for ‘backup type’\n\
|
||||||
Try 'mv --help' for more information.", x);
|
Try '{} --help' for more information.", x, NAME);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
|
|
||||||
if overwrite_mode == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup {
|
if overwrite_mode == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup {
|
||||||
show_error!("options --backup and --no-clobber are mutually exclusive\n\
|
show_error!("options --backup and --no-clobber are mutually exclusive\n\
|
||||||
Try 'mv --help' for more information.");
|
Try '{} --help' for more information.", NAME);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
None => {
|
None => {
|
||||||
show_error!("option '--suffix' requires an argument\n\
|
show_error!("option '--suffix' requires an argument\n\
|
||||||
Try 'mv --help' for more information.");
|
Try '{} --help' for more information.", NAME);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ fn exec(files: &[PathBuf], b: Behaviour) -> i32 {
|
||||||
match files {
|
match files {
|
||||||
[] | [_] => {
|
[] | [_] => {
|
||||||
show_error!("missing file operand\n\
|
show_error!("missing file operand\n\
|
||||||
Try 'mv --help' for more information.");
|
Try '{} --help' for more information.", NAME);
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
[ref source, ref target] => {
|
[ref source, ref target] => {
|
||||||
|
@ -220,7 +220,7 @@ fn exec(files: &[PathBuf], b: Behaviour) -> i32 {
|
||||||
fs => {
|
fs => {
|
||||||
if b.no_target_dir {
|
if b.no_target_dir {
|
||||||
show_error!("mv: extra operand ‘{}’\n\
|
show_error!("mv: extra operand ‘{}’\n\
|
||||||
Try 'mv --help' for more information.", fs[2].display());
|
Try '{} --help' for more information.", fs[2].display(), NAME);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
let target_dir = fs.last().unwrap();
|
let target_dir = fs.last().unwrap();
|
||||||
|
|
|
@ -47,12 +47,12 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
let msg = format!("{0} v{1}
|
let msg = format!("{0} {1}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{0} [OPTIONS] [COMMAND [ARGS]]
|
{0} [OPTIONS] [COMMAND [ARGS]]
|
||||||
|
|
|
@ -324,5 +324,5 @@ fn print_usage(opts: &getopts::Options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version() {
|
fn version() {
|
||||||
println!("{} version {}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("V") { println!("{} v{}", NAME, VERSION); return 0 }
|
if matches.opt_present("V") { println!("{} {}", NAME, VERSION); return 0 }
|
||||||
if matches.opt_present("h") { show_usage(&opts); return 0 }
|
if matches.opt_present("h") { show_usage(&opts); return 0 }
|
||||||
|
|
||||||
if matches.free.len() == 0 {
|
if matches.free.len() == 0 {
|
||||||
|
@ -133,7 +133,7 @@ fn find_stdout() -> File {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_usage(opts: &getopts::Options) {
|
fn show_usage(opts: &getopts::Options) {
|
||||||
let msg = format!("{0} v{1}
|
let msg = format!("{0} {1}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{0} COMMAND [ARG]...
|
{0} COMMAND [ARG]...
|
||||||
|
|
|
@ -44,7 +44,7 @@ Usage:
|
||||||
Print the full filename of the current working directory.", NAME, VERSION);
|
Print the full filename of the current working directory.", NAME, VERSION);
|
||||||
print!("{}", opts.usage(&msg));
|
print!("{}", opts.usage(&msg));
|
||||||
} else if matches.opt_present("version") {
|
} else if matches.opt_present("version") {
|
||||||
println!("{} version: {}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
} else {
|
} else {
|
||||||
println!("{}", env::current_dir().unwrap().display());
|
println!("{}", env::current_dir().unwrap().display());
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version() {
|
fn version() {
|
||||||
println!("{} v{}", NAME, VERSION)
|
println!("{} {}", NAME, VERSION)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_usage(opts: &getopts::Options) {
|
fn show_usage(opts: &getopts::Options) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version() {
|
fn version() {
|
||||||
println!("{} v{}", NAME, VERSION)
|
println!("{} {}", NAME, VERSION)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_usage(opts: &getopts::Options) {
|
fn show_usage(opts: &getopts::Options) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
let msg = format!("{0} v{1}
|
let msg = format!("{0} {1}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{0} [OPTION]... [FILE]
|
{0} [OPTION]... [FILE]
|
||||||
|
@ -61,7 +61,7 @@ Write a random permutation of the input lines to standard output.
|
||||||
With no FILE, or when FILE is -, read standard input.", NAME, VERSION);
|
With no FILE, or when FILE is -, read standard input.", NAME, VERSION);
|
||||||
print!("{}", opts.usage(&msg));
|
print!("{}", opts.usage(&msg));
|
||||||
} else if matches.opt_present("version") {
|
} else if matches.opt_present("version") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
} else {
|
} else {
|
||||||
let echo = matches.opt_present("echo");
|
let echo = matches.opt_present("echo");
|
||||||
let mode = match matches.opt_str("input-range") {
|
let mode = match matches.opt_str("input-range") {
|
||||||
|
|
|
@ -42,7 +42,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("h") {
|
if matches.opt_present("h") {
|
||||||
let msg = format!("{0} v{1}
|
let msg = format!("{0} {1}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{0} [OPTION]... [INPUT [PREFIX]]
|
{0} [OPTION]... [INPUT [PREFIX]]
|
||||||
|
@ -56,7 +56,7 @@ size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.opt_present("V") {
|
if matches.opt_present("V") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ fn preload_strings() -> (&'static str, &'static str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_version() {
|
fn print_version() {
|
||||||
println!("{} version {}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_usage(opts: &Options) {
|
fn print_usage(opts: &Options) {
|
||||||
|
|
|
@ -296,5 +296,5 @@ fn print_string<T: Write>(_: &mut T, s: &String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version () {
|
fn version () {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,14 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
print!("{} v{}
|
print!("{} {}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
{} [OPTION] DURATION COMMAND [ARG]...
|
{} [OPTION] DURATION COMMAND [ARG]...
|
||||||
|
|
||||||
{}", NAME, VERSION, program, getopts::usage("Start COMMAND, and kill it if still running after DURATION.", &opts));
|
{}", NAME, VERSION, program, getopts::usage("Start COMMAND, and kill it if still running after DURATION.", &opts));
|
||||||
} else if matches.opt_present("version") {
|
} else if matches.opt_present("version") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
} else if matches.free.len() < 2 {
|
} else if matches.free.len() < 2 {
|
||||||
show_error!("missing an argument");
|
show_error!("missing an argument");
|
||||||
show_error!("for help, try '{0} --help'", program);
|
show_error!("for help, try '{0} --help'", program);
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("h") {
|
if matches.opt_present("h") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
println!("");
|
println!("");
|
||||||
println!("Usage:");
|
println!("Usage:");
|
||||||
println!(" {} [OPTIONS] FILE", NAME);
|
println!(" {} [OPTIONS] FILE", NAME);
|
||||||
|
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.opt_present("V") {
|
if matches.opt_present("V") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
println!("{} v{}\n", NAME, VERSION);
|
println!("{} {}\n", NAME, VERSION);
|
||||||
println!("Usage: {} [OPTION]... [FILE]...\n", NAME);
|
println!("Usage: {} [OPTION]... [FILE]...\n", NAME);
|
||||||
println!("{}", opts.usage(
|
println!("{}", opts.usage(
|
||||||
"Convert blanks in each FILE to tabs, writing to standard output.\n\
|
"Convert blanks in each FILE to tabs, writing to standard output.\n\
|
||||||
|
@ -109,7 +109,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.opt_present("V") {
|
if matches.opt_present("V") {
|
||||||
println!("{} v{}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue