mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
change ~ disp_err!()
=> show_usage_error!()
(from uucore v0.0.4)
This commit is contained in:
parent
6f465eeb9f
commit
4b8fc7445b
10 changed files with 20 additions and 20 deletions
|
@ -45,7 +45,7 @@ pub fn execute(
|
|||
let decode = matches.opt_present("decode");
|
||||
|
||||
if matches.free.len() > 1 {
|
||||
disp_err!("extra operand ‘{}’", matches.free[0]);
|
||||
show_usage_error!("extra operand ‘{}’", matches.free[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ pub fn execute(
|
|||
let decode = matches.opt_present("decode");
|
||||
|
||||
if matches.free.len() > 1 {
|
||||
disp_err!("extra operand ‘{}’", matches.free[0]);
|
||||
show_usage_error!("extra operand ‘{}’", matches.free[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,10 +115,10 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
};
|
||||
|
||||
if matches.free.is_empty() {
|
||||
disp_err!("missing operand");
|
||||
show_usage_error!("missing operand");
|
||||
return 1;
|
||||
} else if matches.free.len() < 2 && !matches.opt_present("reference") {
|
||||
disp_err!("missing operand after ‘{}’", matches.free[0]);
|
||||
show_usage_error!("missing operand after ‘{}’", matches.free[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,10 +135,10 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
};
|
||||
|
||||
if matches.free.is_empty() {
|
||||
disp_err!("missing operand");
|
||||
show_usage_error!("missing operand");
|
||||
return 1;
|
||||
} else if matches.free.len() < 2 && !matches.opt_present("reference") {
|
||||
disp_err!("missing operand after ‘{}’", matches.free[0]);
|
||||
show_usage_error!("missing operand after ‘{}’", matches.free[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
|| matches.opt_present("bourne-shell"))
|
||||
&& matches.opt_present("print-database")
|
||||
{
|
||||
disp_err!(
|
||||
show_usage_error!(
|
||||
"the options to output dircolors' internal database and\nto select a shell \
|
||||
syntax are mutually exclusive"
|
||||
);
|
||||
|
@ -80,7 +80,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
|
||||
if matches.opt_present("print-database") {
|
||||
if !matches.free.is_empty() {
|
||||
disp_err!(
|
||||
show_usage_error!(
|
||||
"extra operand ‘{}’\nfile operands cannot be combined with \
|
||||
--print-database (-p)",
|
||||
matches.free[0]
|
||||
|
@ -113,7 +113,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
result = parse(INTERNAL_DB.lines(), out_format, "")
|
||||
} else {
|
||||
if matches.free.len() > 1 {
|
||||
disp_err!("extra operand ‘{}’", matches.free[1]);
|
||||
show_usage_error!("extra operand ‘{}’", matches.free[1]);
|
||||
return 1;
|
||||
}
|
||||
match File::open(matches.free[0].as_str()) {
|
||||
|
|
|
@ -117,8 +117,8 @@ for details about the options it supports.",
|
|||
|
||||
let mut ret = 0i32;
|
||||
match matches.free.len() {
|
||||
0 => disp_err!("missing operand"),
|
||||
1 => disp_err!("missing operand after ‘{}’", matches.free[0]),
|
||||
0 => show_usage_error!("missing operand"),
|
||||
1 => show_usage_error!("missing operand after ‘{}’", matches.free[0]),
|
||||
_ => {
|
||||
let args = &matches.free;
|
||||
let c_str = CString::new(args[0].as_str()).expect("Failed to convert to CString");
|
||||
|
@ -150,10 +150,10 @@ for details about the options it supports.",
|
|||
eprintln!("Try '{} --help' for more information.", NAME);
|
||||
return 1;
|
||||
} else if args.len() > 4 {
|
||||
disp_err!("extra operand ‘{}’", args[4]);
|
||||
show_usage_error!("extra operand ‘{}’", args[4]);
|
||||
return 1;
|
||||
} else if !"bcu".contains(ch) {
|
||||
disp_err!("invalid device type ‘{}’", args[1]);
|
||||
show_usage_error!("invalid device type ‘{}’", args[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
let matches = match opts.parse(&args[1..]) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
disp_err!("{}", f);
|
||||
show_usage_error!("{}", f);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
@ -310,7 +310,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
|
||||
let od_options = match OdOptions::new(matches, args) {
|
||||
Err(s) => {
|
||||
disp_err!("{}", s);
|
||||
show_usage_error!("{}", s);
|
||||
return 1;
|
||||
}
|
||||
Ok(o) => o,
|
||||
|
|
|
@ -119,7 +119,7 @@ The utmp file will be {}",
|
|||
}
|
||||
|
||||
if !do_short_format && matches.free.is_empty() {
|
||||
disp_err!("no username specified; at least one must be specified when using -l");
|
||||
show_usage_error!("no username specified; at least one must be specified when using -l");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ The utmp file will be {}",
|
|||
|
||||
if do_short_format {
|
||||
if let Err(e) = pk.short_pinky() {
|
||||
disp_err!("{}", e);
|
||||
show_usage_error!("{}", e);
|
||||
1
|
||||
} else {
|
||||
0
|
||||
|
|
|
@ -891,7 +891,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
let matches = match opts.parse(&args[1..]) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
disp_err!("{}", f);
|
||||
show_usage_error!("{}", f);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
@ -903,7 +903,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
}
|
||||
|
||||
if matches.free.is_empty() {
|
||||
disp_err!("missing operand");
|
||||
show_usage_error!("missing operand");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
}
|
||||
|
||||
if matches.free.len() > 2 {
|
||||
disp_err!("{}", msg_wrong_number_of_arguments!());
|
||||
show_usage_error!("{}", msg_wrong_number_of_arguments!());
|
||||
exit!(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue