mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #246 from ebfe/remove-to-err-msg
remove use of deprecated to_err_msg
This commit is contained in:
commit
7920c7d9e4
38 changed files with 38 additions and 38 deletions
|
@ -48,7 +48,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts(args.tail(), opts) {
|
let matches = match getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("error: {:s}", e.to_err_msg());
|
error!("error: {}", e);
|
||||||
fail!()
|
fail!()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "Invalid options\n{}", f.to_err_msg())
|
Err(f) => crash!(1, "Invalid options\n{}", f)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -41,7 +41,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
];
|
];
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => fail!("Invalid options\n{}", f.to_err_msg())
|
Err(f) => fail!("Invalid options\n{}", f)
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
println!("cat 1.0.0");
|
println!("cat 1.0.0");
|
||||||
|
|
|
@ -88,7 +88,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(err) => fail!("{}", err.to_err_msg()),
|
Err(err) => fail!("{}", err),
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -109,7 +109,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(err) => fail!("{}", err.to_err_msg()),
|
Err(err) => fail!("{}", err),
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
|
|
2
cp/cp.rs
2
cp/cp.rs
|
@ -42,7 +42,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts(args.tail(), opts) {
|
let matches = match getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("error: {:s}", e.to_err_msg());
|
error!("error: {}", e);
|
||||||
fail!()
|
fail!()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => fail!("Invalid options\n{}", f.to_err_msg())
|
Err(f) => fail!("Invalid options\n{}", f)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
2
du/du.rs
2
du/du.rs
|
@ -162,7 +162,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
show_error!("Invalid options\n{}", f.to_err_msg());
|
show_error!("Invalid options\n{}", f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -85,7 +85,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "Invalid options\n{}", f.to_err_msg())
|
Err(f) => crash!(1, "Invalid options\n{}", f)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -77,7 +77,7 @@ pub fn uumain(args: Vec<String>) {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "Invalid options\n{}", f.to_err_msg())
|
Err(f) => crash!(1, "Invalid options\n{}", f)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "{}", f.to_err_msg())
|
Err(f) => crash!(1, "{}", f)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("h") {
|
if matches.opt_present("h") {
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts(args.tail(), options) {
|
let matches = match getopts(args.tail(), options) {
|
||||||
Ok(m) => { m },
|
Ok(m) => { m },
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
show_error!("{}", f.to_err_msg());
|
show_error!("{}", f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts(args.tail(), opts) {
|
let matches = match getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
show_error!("{}\n{}", e.to_err_msg(), get_help_text(NAME, usage.as_slice()));
|
show_error!("{}\n{}", e, get_help_text(NAME, usage.as_slice()));
|
||||||
return EXIT_ERR;
|
return EXIT_ERR;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,7 +71,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts(args.tail(), opts) {
|
let matches = match getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
show_error!("{}\n{}", e.to_err_msg(), get_help_text(NAME, usage.as_slice()));
|
show_error!("{}\n{}", e, get_help_text(NAME, usage.as_slice()));
|
||||||
return EXIT_ERR;
|
return EXIT_ERR;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "Invalid options\n{}", f.to_err_msg())
|
Err(f) => crash!(1, "Invalid options\n{}", f)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -49,7 +49,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "{}", f.to_err_msg())
|
Err(f) => crash!(1, "{}", f)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "Invalid options\n{}", f.to_err_msg());
|
crash!(1, "Invalid options\n{}", f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
];
|
];
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "{}", f.to_err_msg())
|
Err(f) => crash!(1, "{}", f)
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
println!("{} {}", NAME, VERSION);
|
println!("{} {}", NAME, VERSION);
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "Invalid options\n{}", f.to_err_msg())
|
crash!(1, "Invalid options\n{}", f)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "Invalid options\n{}", f.to_err_msg())
|
crash!(1, "Invalid options\n{}", f)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
2
rm/rm.rs
2
rm/rm.rs
|
@ -53,7 +53,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "{}", f.to_err_msg())
|
crash!(1, "{}", f)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
show_error!("{}", f.to_err_msg());
|
show_error!("{}", f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => { m }
|
Ok(m) => { m }
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
show_error!("{:s}", f.to_err_msg());
|
show_error!("{}", f);
|
||||||
print_usage(opts);
|
print_usage(opts);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
show_error!("{}", f.to_err_msg());
|
show_error!("{}", f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,7 +90,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "Invalid options\n{}", f.to_err_msg())
|
Err(f) => crash!(1, "Invalid options\n{}", f)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
];
|
];
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "{}", f.to_err_msg())
|
Err(f) => crash!(1, "{}", f)
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
println!("tac {}", VERSION);
|
println!("tac {}", VERSION);
|
||||||
|
|
|
@ -52,7 +52,7 @@ fn options(args: &[String]) -> Result<Options, ()> {
|
||||||
|
|
||||||
let args: Vec<String> = args.iter().map(|x| x.to_string()).collect();
|
let args: Vec<String> = args.iter().map(|x| x.to_string()).collect();
|
||||||
|
|
||||||
getopts(args.tail(), opts).map_err(|e| e.to_err_msg()).and_then(|m| {
|
getopts(args.tail(), opts).map_err(|e| format!("{}", e)).and_then(|m| {
|
||||||
let version = format!("{} {}", NAME, VERSION);
|
let version = format!("{} {}", NAME, VERSION);
|
||||||
let program = args.get(0).as_slice();
|
let program = args.get(0).as_slice();
|
||||||
let arguments = "[OPTION]... [FILE]...";
|
let arguments = "[OPTION]... [FILE]...";
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(e) => fail!("Invalid options\n{}", e.to_err_msg())
|
Err(e) => fail!("Invalid options\n{}", e)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
|
|
2
tr/tr.rs
2
tr/tr.rs
|
@ -161,7 +161,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
show_error!("{}", err.to_err_msg());
|
show_error!("{}", err);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,7 +51,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "{}", f.to_err_msg())
|
crash!(1, "{}", f)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
m.opt_present("s")
|
m.opt_present("s")
|
||||||
},
|
},
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
println(f.to_err_msg().as_slice());
|
println!("{}", f);
|
||||||
usage();
|
usage();
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
];
|
];
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "{}", f.to_err_msg()),
|
Err(f) => crash!(1, "{}", f),
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
println!("uname 1.0.0");
|
println!("uname 1.0.0");
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "invalid options\n{}", f.to_err_msg())
|
crash!(1, "invalid options\n{}", f)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
];
|
];
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "Invalid options\n{}", f.to_err_msg())
|
Err(f) => crash!(1, "Invalid options\n{}", f)
|
||||||
};
|
};
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
println!("uptime 1.0.0");
|
println!("uptime 1.0.0");
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => fail!(f.to_err_msg()),
|
Err(f) => fail!("{}", f),
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
2
wc/wc.rs
2
wc/wc.rs
|
@ -52,7 +52,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "Invalid options\n{}", f.to_err_msg())
|
crash!(1, "Invalid options\n{}", f)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
];
|
];
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!(1, "{}", f.to_err_msg()),
|
Err(f) => crash!(1, "{}", f),
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
println!("whoami 1.0.0");
|
println!("whoami 1.0.0");
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
let matches = match getopts::getopts(args.tail(), opts) {
|
let matches = match getopts::getopts(args.tail(), opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "invalid options\n{}", f.to_err_msg())
|
crash!(1, "invalid options\n{}", f)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if matches.opt_present("help") {
|
if matches.opt_present("help") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue