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:
@@ -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(),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user