Skip to content

Commit

Permalink
adjust the name
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Feb 17, 2024
1 parent b7dfc41 commit 0c47825
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 32 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of the uutils coreutils package.
// This file is part of the uutils acl package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
Expand Down
16 changes: 8 additions & 8 deletions src/bin/acl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn gen_completions<T: uucore::Args>(
args: impl Iterator<Item = OsString>,
util_map: &UtilityMap<T>,
) -> ! {
let all_utilities: Vec<_> = std::iter::once("coreutils")
let all_utilities: Vec<_> = std::iter::once("acl")
.chain(util_map.keys().copied())
.collect();

Expand All @@ -163,8 +163,8 @@ fn gen_completions<T: uucore::Args>(
let utility = matches.get_one::<String>("utility").unwrap();
let shell = *matches.get_one::<Shell>("shell").unwrap();

let mut command = if utility == "coreutils" {
gen_coreutils_app(util_map)
let mut command = if utility == "acl" {
gen_acl_app(util_map)
} else {
util_map.get(utility).unwrap().1()
};
Expand All @@ -180,7 +180,7 @@ fn gen_manpage<T: uucore::Args>(
args: impl Iterator<Item = OsString>,
util_map: &UtilityMap<T>,
) -> ! {
let all_utilities: Vec<_> = std::iter::once("coreutils")
let all_utilities: Vec<_> = std::iter::once("acl")
.chain(util_map.keys().copied())
.collect();

Expand All @@ -195,8 +195,8 @@ fn gen_manpage<T: uucore::Args>(

let utility = matches.get_one::<String>("utility").unwrap();

let command = if utility == "coreutils" {
gen_coreutils_app(util_map)
let command = if utility == "acl" {
gen_acl_app(util_map)
} else {
util_map.get(utility).unwrap().1()
};
Expand All @@ -208,8 +208,8 @@ fn gen_manpage<T: uucore::Args>(
process::exit(0);
}

fn gen_coreutils_app<T: uucore::Args>(util_map: &UtilityMap<T>) -> Command {
let mut command = Command::new("coreutils");
fn gen_acl_app<T: uucore::Args>(util_map: &UtilityMap<T>) -> Command {
let mut command = Command::new("acl");
for (name, (_, sub_app)) in util_map {
// Recreate a small subcommand with only the relevant info
// (name & short description)
Expand Down
2 changes: 1 addition & 1 deletion src/bin/uudoc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of the uutils coreutils package.
// This file is part of the uutils acl package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
Expand Down
36 changes: 21 additions & 15 deletions src/uu/getfacl/src/getfacl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// file that was distributed with this source code.

use clap::{crate_version, Arg, ArgAction, Command};
use uucore::{error::UResult, help_about, help_usage};
use xattr;
use std::fs;
use std::os::unix::fs::{MetadataExt, PermissionsExt};
use users::{get_user_by_uid, get_group_by_gid};
use users::{get_group_by_gid, get_user_by_uid};
use uucore::{error::UResult, help_about, help_usage};
use xattr;

const ABOUT: &str = help_about!("getfacl.md");
const USAGE: &str = help_usage!("getfacl.md");
Expand All @@ -27,18 +27,24 @@ fn print_file_acl(file_path: &str) -> std::io::Result<()> {
// Fetching and formatting file permissions
let perms = metadata.permissions();
let mode = perms.mode();
let user_perms = format!("{}{}{}",
if mode & 0o400 != 0 { "r" } else { "-" },
if mode & 0o200 != 0 { "w" } else { "-" },
if mode & 0o100 != 0 { "x" } else { "-" });
let group_perms = format!("{}{}{}",
if mode & 0o040 != 0 { "r" } else { "-" },
if mode & 0o020 != 0 { "w" } else { "-" },
if mode & 0o010 != 0 { "x" } else { "-" });
let other_perms = format!("{}{}{}",
if mode & 0o004 != 0 { "r" } else { "-" },
if mode & 0o002 != 0 { "w" } else { "-" },
if mode & 0o001 != 0 { "x" } else { "-" });
let user_perms = format!(
"{}{}{}",
if mode & 0o400 != 0 { "r" } else { "-" },
if mode & 0o200 != 0 { "w" } else { "-" },
if mode & 0o100 != 0 { "x" } else { "-" }
);
let group_perms = format!(
"{}{}{}",
if mode & 0o040 != 0 { "r" } else { "-" },
if mode & 0o020 != 0 { "w" } else { "-" },
if mode & 0o010 != 0 { "x" } else { "-" }
);
let other_perms = format!(
"{}{}{}",
if mode & 0o004 != 0 { "r" } else { "-" },
if mode & 0o002 != 0 { "w" } else { "-" },
if mode & 0o001 != 0 { "x" } else { "-" }
);

// Generating the output
println!("# file: {}", file_path);
Expand Down
2 changes: 1 addition & 1 deletion tests/by-util/test_chacl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of the uutils procps package.
// This file is part of the uutils acl package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
Expand Down
4 changes: 2 additions & 2 deletions tests/by-util/test_getfacl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of the uutils procps package.
// This file is part of the uutils acl package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
Expand All @@ -8,5 +8,5 @@ use crate::common::util::TestScenario;

#[test]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(101);
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}
4 changes: 2 additions & 2 deletions tests/common/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of the uutils coreutils package.
// This file is part of the uutils acl package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
Expand Down Expand Up @@ -77,7 +77,7 @@ macro_rules! at_and_ucmd {
}

/// If `common::util::expected_result` returns an error, i.e. the `util` in `$PATH` doesn't
/// include a coreutils version string or the version is too low,
/// include a acl version string or the version is too low,
/// this macro can be used to automatically skip the test and print the reason.
#[macro_export]
macro_rules! unwrap_or_return {
Expand Down
2 changes: 1 addition & 1 deletion tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of the uutils coreutils package.
// This file is part of the uutils acl package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/common/random.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of the uutils coreutils package.
// This file is part of the uutils acl package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
Expand Down

0 comments on commit 0c47825

Please sign in to comment.