feat: pure before sync
Added arg that will cause to run pure subcommand before sync.
This commit is contained in:
+12
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user