mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
chgrp: split the functions into two
This commit is contained in:
parent
9c42b8efdc
commit
4c3e9c893a
1 changed files with 7 additions and 2 deletions
|
@ -37,8 +37,8 @@ fn parse_gid_from_str(group: &str) -> Result<u32, String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_gid_and_uid(matches: &ArgMatches) -> UResult<GidUidOwnerFilter> {
|
fn get_dest_gid(matches: &ArgMatches) -> UResult<(Option<u32>, String)> {
|
||||||
let mut raw_group: String = String::new();
|
let mut raw_group = String::new();
|
||||||
let dest_gid = if let Some(file) = matches.get_one::<String>(options::REFERENCE) {
|
let dest_gid = if let Some(file) = matches.get_one::<String>(options::REFERENCE) {
|
||||||
fs::metadata(file)
|
fs::metadata(file)
|
||||||
.map(|meta| {
|
.map(|meta| {
|
||||||
|
@ -62,6 +62,11 @@ fn parse_gid_and_uid(matches: &ArgMatches) -> UResult<GidUidOwnerFilter> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Ok((dest_gid, raw_group))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_gid_and_uid(matches: &ArgMatches) -> UResult<GidUidOwnerFilter> {
|
||||||
|
let (dest_gid, raw_group) = get_dest_gid(matches)?;
|
||||||
|
|
||||||
// Handle --from option
|
// Handle --from option
|
||||||
let filter = if let Some(from_group) = matches.get_one::<String>(options::FROM) {
|
let filter = if let Some(from_group) = matches.get_one::<String>(options::FROM) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue