1
Fork 0
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:
Roy Ivy III 2020-05-27 01:03:24 -05:00
parent 6f465eeb9f
commit 4b8fc7445b
10 changed files with 20 additions and 20 deletions

View file

@ -45,7 +45,7 @@ pub fn execute(
let decode = matches.opt_present("decode"); let decode = matches.opt_present("decode");
if matches.free.len() > 1 { if matches.free.len() > 1 {
disp_err!("extra operand {}", matches.free[0]); show_usage_error!("extra operand {}", matches.free[0]);
return 1; return 1;
} }

View file

@ -45,7 +45,7 @@ pub fn execute(
let decode = matches.opt_present("decode"); let decode = matches.opt_present("decode");
if matches.free.len() > 1 { if matches.free.len() > 1 {
disp_err!("extra operand {}", matches.free[0]); show_usage_error!("extra operand {}", matches.free[0]);
return 1; return 1;
} }

View file

@ -115,10 +115,10 @@ pub fn uumain(args: Vec<String>) -> i32 {
}; };
if matches.free.is_empty() { if matches.free.is_empty() {
disp_err!("missing operand"); show_usage_error!("missing operand");
return 1; return 1;
} else if matches.free.len() < 2 && !matches.opt_present("reference") { } 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; return 1;
} }

View file

@ -135,10 +135,10 @@ pub fn uumain(args: Vec<String>) -> i32 {
}; };
if matches.free.is_empty() { if matches.free.is_empty() {
disp_err!("missing operand"); show_usage_error!("missing operand");
return 1; return 1;
} else if matches.free.len() < 2 && !matches.opt_present("reference") { } 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; return 1;
} }

View file

@ -71,7 +71,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|| matches.opt_present("bourne-shell")) || matches.opt_present("bourne-shell"))
&& matches.opt_present("print-database") && matches.opt_present("print-database")
{ {
disp_err!( show_usage_error!(
"the options to output dircolors' internal database and\nto select a shell \ "the options to output dircolors' internal database and\nto select a shell \
syntax are mutually exclusive" syntax are mutually exclusive"
); );
@ -80,7 +80,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
if matches.opt_present("print-database") { if matches.opt_present("print-database") {
if !matches.free.is_empty() { if !matches.free.is_empty() {
disp_err!( show_usage_error!(
"extra operand {}\nfile operands cannot be combined with \ "extra operand {}\nfile operands cannot be combined with \
--print-database (-p)", --print-database (-p)",
matches.free[0] matches.free[0]
@ -113,7 +113,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
result = parse(INTERNAL_DB.lines(), out_format, "") result = parse(INTERNAL_DB.lines(), out_format, "")
} else { } else {
if matches.free.len() > 1 { if matches.free.len() > 1 {
disp_err!("extra operand {}", matches.free[1]); show_usage_error!("extra operand {}", matches.free[1]);
return 1; return 1;
} }
match File::open(matches.free[0].as_str()) { match File::open(matches.free[0].as_str()) {

View file

@ -117,8 +117,8 @@ for details about the options it supports.",
let mut ret = 0i32; let mut ret = 0i32;
match matches.free.len() { match matches.free.len() {
0 => disp_err!("missing operand"), 0 => show_usage_error!("missing operand"),
1 => disp_err!("missing operand after {}", matches.free[0]), 1 => show_usage_error!("missing operand after {}", matches.free[0]),
_ => { _ => {
let args = &matches.free; let args = &matches.free;
let c_str = CString::new(args[0].as_str()).expect("Failed to convert to CString"); 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); eprintln!("Try '{} --help' for more information.", NAME);
return 1; return 1;
} else if args.len() > 4 { } else if args.len() > 4 {
disp_err!("extra operand {}", args[4]); show_usage_error!("extra operand {}", args[4]);
return 1; return 1;
} else if !"bcu".contains(ch) { } else if !"bcu".contains(ch) {
disp_err!("invalid device type {}", args[1]); show_usage_error!("invalid device type {}", args[1]);
return 1; return 1;
} }

View file

@ -294,7 +294,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
let matches = match opts.parse(&args[1..]) { let matches = match opts.parse(&args[1..]) {
Ok(m) => m, Ok(m) => m,
Err(f) => { Err(f) => {
disp_err!("{}", f); show_usage_error!("{}", f);
return 1; return 1;
} }
}; };
@ -310,7 +310,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
let od_options = match OdOptions::new(matches, args) { let od_options = match OdOptions::new(matches, args) {
Err(s) => { Err(s) => {
disp_err!("{}", s); show_usage_error!("{}", s);
return 1; return 1;
} }
Ok(o) => o, Ok(o) => o,

View file

@ -119,7 +119,7 @@ The utmp file will be {}",
} }
if !do_short_format && matches.free.is_empty() { 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; return 1;
} }
@ -136,7 +136,7 @@ The utmp file will be {}",
if do_short_format { if do_short_format {
if let Err(e) = pk.short_pinky() { if let Err(e) = pk.short_pinky() {
disp_err!("{}", e); show_usage_error!("{}", e);
1 1
} else { } else {
0 0

View file

@ -891,7 +891,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
let matches = match opts.parse(&args[1..]) { let matches = match opts.parse(&args[1..]) {
Ok(m) => m, Ok(m) => m,
Err(f) => { Err(f) => {
disp_err!("{}", f); show_usage_error!("{}", f);
return 1; return 1;
} }
}; };
@ -903,7 +903,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
} }
if matches.free.is_empty() { if matches.free.is_empty() {
disp_err!("missing operand"); show_usage_error!("missing operand");
return 1; return 1;
} }

View file

@ -205,7 +205,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
} }
if matches.free.len() > 2 { if matches.free.len() > 2 {
disp_err!("{}", msg_wrong_number_of_arguments!()); show_usage_error!("{}", msg_wrong_number_of_arguments!());
exit!(1); exit!(1);
} }
} }