mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
Added UResult for dirname
This commit is contained in:
parent
f66f10c4ed
commit
23f5f55560
1 changed files with 5 additions and 4 deletions
|
@ -10,6 +10,7 @@ extern crate uucore;
|
|||
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::path::Path;
|
||||
use uucore::error::{UResult, USimpleError};
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
static ABOUT: &str = "strip last component from file name";
|
||||
|
@ -30,7 +31,8 @@ fn get_long_usage() -> String {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
@ -77,11 +79,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
print!("{}", separator);
|
||||
}
|
||||
} else {
|
||||
show_usage_error!("missing operand");
|
||||
return 1;
|
||||
return Err(USimpleError::new(1, format!("missing operand")));
|
||||
}
|
||||
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app() -> App<'static, 'static> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue