From 8c83e733c208f3e62d312dfccd218be8ffe049ea Mon Sep 17 00:00:00 2001 From: theMZet Date: Sat, 30 May 2026 01:10:12 +0200 Subject: [PATCH] feat: pure before sync Added arg that will cause to run pure subcommand before sync. --- src/main.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index a2ebb16..c5d22ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,7 +65,13 @@ struct Args { #[derive(Debug, Clone, Copy, Subcommand)] enum Commands { /// Synchronizes state of machine with the world file and update everythink - Sync, + Sync { + #[arg(short = 'r', long)] + pure: bool, + + #[arg(short = 'a', long)] + pure_all: bool, + }, /// Export currently installed packages to the world file Export { #[arg(short, long)] @@ -99,11 +105,15 @@ fn main() -> Result<()> { }; match args.command { - Commands::Sync => { + Commands::Sync { pure, pure_all } => { let world = World::load_from(world_path)?; let world_state = world.get_packages(); let state = get_system_state()?; + if pure { + pure_command(&world, state.clone(), pure_all, args.quiet)?; + } + let not_installed = { let mut x = world_state.exclude(&state); x.ignore = world_state.ignore.clone(); @@ -261,7 +271,6 @@ fn main() -> Result<()> { } fn pure_command(world: &World, state: Packages, all: bool, quiet: bool) -> Result<()> { - let aditional = { let mut x = state.exclude(world.get_packages()); x.ignore = world.get_packages().ignore.clone();