adjust the name

This commit is contained in:
Sylvestre Ledru
2024-02-17 14:52:58 +01:00
parent b7dfc41856
commit 0c4782590b
9 changed files with 38 additions and 32 deletions
+1 -1
View File
@@ -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.
+8 -8
View File
@@ -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();
@@ -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()
};
@@ -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();
@@ -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()
};
@@ -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)
+1 -1
View File
@@ -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.
+21 -15
View File
@@ -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);
+1 -1
View File
@@ -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.
+2 -2
View File
@@ -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);
}
+2 -2
View File
@@ -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 {
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.