feat: rename AddGroupsCommand to ConfigureGroupsCommand and update references

This commit is contained in:
2025-05-01 21:37:05 +02:00
parent 8048377a6a
commit 0312929b1e
2 changed files with 8 additions and 8 deletions

View File

@@ -30,14 +30,14 @@ pub enum Commands {
InstallRpmFusion, InstallRpmFusion,
#[command(about = "Add groups to a user")] #[command(about = "Add groups to a user")]
AddGroups(AddGroupsCommand), ConfigureGroups(ConfigureGroupsCommand),
#[command(about = "Manage packages")] #[command(about = "Manage packages")]
Package(PackageCommand), Package(PackageCommand),
} }
#[derive(Args, Debug, PartialEq)] #[derive(Args, Debug, PartialEq)]
pub struct AddGroupsCommand { pub struct ConfigureGroupsCommand {
#[arg( #[arg(
short, short,
long, long,

View File

@@ -33,9 +33,9 @@ fn main() {
log::error!("Error installing RPM Fusion: {}", e); log::error!("Error installing RPM Fusion: {}", e);
} }
} }
Commands::AddGroups(add_user_command) => { Commands::ConfigureGroups(configure_groups_command) => {
if let Err(e) = add_groups(add_user_command) { if let Err(e) = configure_groups(configure_groups_command) {
log::error!("Error adding user to groups: {}", e); log::error!("Error configuring groups: {}", e);
} }
} }
Commands::Package(package_command) => { Commands::Package(package_command) => {
@@ -51,10 +51,10 @@ fn main() {
success!("Bye :)"); success!("Bye :)");
} }
fn add_groups(add_user_command: AddGroupsCommand) -> Result<()> { fn configure_groups(configure_groups_command: ConfigureGroupsCommand) -> Result<()> {
let groups = include_str!("../data/user_groups.txt").to_string(); let groups = include_str!("../data/user_groups.txt").to_string();
if add_user_command.print { if configure_groups_command.print {
log::info!("Printing groups..."); log::info!("Printing groups...");
println!("{}", groups); println!("{}", groups);
return Ok(()); return Ok(());
@@ -85,7 +85,7 @@ fn add_groups(add_user_command: AddGroupsCommand) -> Result<()> {
let groups = groups.join(","); let groups = groups.join(",");
let user = add_user_command.user.unwrap_or_else(|| { let user = configure_groups_command.user.unwrap_or_else(|| {
log::info!("No user specified, using current user"); log::info!("No user specified, using current user");
whoami::username() whoami::username()
}); });