feat: diff of states

Added first subcommand - diff.
It allows to check how diffrent
current state of machine is in
compareson to world file.
This commit is contained in:
2026-05-29 20:06:19 +02:00
parent da24be9a63
commit 25fd7a370e
4 changed files with 267 additions and 2 deletions
+30
View File
@@ -0,0 +1,30 @@
use crate::{error::Result, world::Packages};
use std::process::{Command, Stdio};
pub fn get_system_state() -> Result<Packages> {
let command = Command::new("pacman")
.arg("-Qqe")
.stdout(Stdio::piped())
.output()?;
let official: Vec<String> = String::from_utf8(command.stdout)?
.split_whitespace()
.map(|x| x.to_owned())
.collect();
let command = Command::new("pacman")
.arg("-Qqm")
.stdout(Stdio::piped())
.output()?;
let foreign: Vec<String> = String::from_utf8(command.stdout)?
.split_whitespace()
.map(|x| x.to_owned())
.collect();
Ok(Packages {
official,
foreign,
ignore: Vec::new(),
})
}