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,
#[command(about = "Add groups to a user")]
AddGroups(AddGroupsCommand),
ConfigureGroups(ConfigureGroupsCommand),
#[command(about = "Manage packages")]
Package(PackageCommand),
}
#[derive(Args, Debug, PartialEq)]
pub struct AddGroupsCommand {
pub struct ConfigureGroupsCommand {
#[arg(
short,
long,

View File

@@ -33,9 +33,9 @@ fn main() {
log::error!("Error installing RPM Fusion: {}", e);
}
}
Commands::AddGroups(add_user_command) => {
if let Err(e) = add_groups(add_user_command) {
log::error!("Error adding user to groups: {}", e);
Commands::ConfigureGroups(configure_groups_command) => {
if let Err(e) = configure_groups(configure_groups_command) {
log::error!("Error configuring groups: {}", e);
}
}
Commands::Package(package_command) => {
@@ -51,10 +51,10 @@ fn main() {
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();
if add_user_command.print {
if configure_groups_command.print {
log::info!("Printing groups...");
println!("{}", groups);
return Ok(());
@@ -85,7 +85,7 @@ fn add_groups(add_user_command: AddGroupsCommand) -> Result<()> {
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");
whoami::username()
});