From 0c4782590ba569086a02f9069703313b28879bd4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 17 Feb 2024 14:52:58 +0100 Subject: [PATCH] adjust the name --- build.rs | 2 +- src/bin/acl.rs | 16 ++++++++-------- src/bin/uudoc.rs | 2 +- src/uu/getfacl/src/getfacl.rs | 36 ++++++++++++++++++++--------------- tests/by-util/test_chacl.rs | 2 +- tests/by-util/test_getfacl.rs | 4 ++-- tests/common/macros.rs | 4 ++-- tests/common/mod.rs | 2 +- tests/common/random.rs | 2 +- 9 files changed, 38 insertions(+), 32 deletions(-) diff --git a/build.rs b/build.rs index bb4e2b5..36b541e 100644 --- a/build.rs +++ b/build.rs @@ -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. diff --git a/src/bin/acl.rs b/src/bin/acl.rs index 62b55e6..f574d0c 100644 --- a/src/bin/acl.rs +++ b/src/bin/acl.rs @@ -142,7 +142,7 @@ fn gen_completions( args: impl Iterator, util_map: &UtilityMap, ) -> ! { - let all_utilities: Vec<_> = std::iter::once("coreutils") + let all_utilities: Vec<_> = std::iter::once("acl") .chain(util_map.keys().copied()) .collect(); @@ -163,8 +163,8 @@ fn gen_completions( let utility = matches.get_one::("utility").unwrap(); let shell = *matches.get_one::("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() }; @@ -180,7 +180,7 @@ fn gen_manpage( args: impl Iterator, util_map: &UtilityMap, ) -> ! { - let all_utilities: Vec<_> = std::iter::once("coreutils") + let all_utilities: Vec<_> = std::iter::once("acl") .chain(util_map.keys().copied()) .collect(); @@ -195,8 +195,8 @@ fn gen_manpage( let utility = matches.get_one::("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() }; @@ -208,8 +208,8 @@ fn gen_manpage( process::exit(0); } -fn gen_coreutils_app(util_map: &UtilityMap) -> Command { - let mut command = Command::new("coreutils"); +fn gen_acl_app(util_map: &UtilityMap) -> 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) diff --git a/src/bin/uudoc.rs b/src/bin/uudoc.rs index 77c7a2f..62a6031 100644 --- a/src/bin/uudoc.rs +++ b/src/bin/uudoc.rs @@ -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. diff --git a/src/uu/getfacl/src/getfacl.rs b/src/uu/getfacl/src/getfacl.rs index 7bf2a35..580b89a 100644 --- a/src/uu/getfacl/src/getfacl.rs +++ b/src/uu/getfacl/src/getfacl.rs @@ -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"); @@ -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); diff --git a/tests/by-util/test_chacl.rs b/tests/by-util/test_chacl.rs index c3afeaf..78ee328 100644 --- a/tests/by-util/test_chacl.rs +++ b/tests/by-util/test_chacl.rs @@ -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. diff --git a/tests/by-util/test_getfacl.rs b/tests/by-util/test_getfacl.rs index 7b6fd99..78ee328 100644 --- a/tests/by-util/test_getfacl.rs +++ b/tests/by-util/test_getfacl.rs @@ -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. @@ -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); } diff --git a/tests/common/macros.rs b/tests/common/macros.rs index 4902ca4..0c5e0f0 100644 --- a/tests/common/macros.rs +++ b/tests/common/macros.rs @@ -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. @@ -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 { diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 05e2b13..7d77076 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -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. diff --git a/tests/common/random.rs b/tests/common/random.rs index 42b6eaa..2eef448 100644 --- a/tests/common/random.rs +++ b/tests/common/random.rs @@ -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.