Crates.io | pacmanager_wrapper |
lib.rs | pacmanager_wrapper |
version | 0.2.0 |
source | src |
created_at | 2024-03-16 12:44:49.412055 |
updated_at | 2024-03-17 07:12:18.033549 |
description | A utility to interact with any package manager on any Linux distro |
homepage | |
repository | https://github.com/Normantas/pacmanager_wrapper |
max_upload_size | |
id | 1175592 |
size | 43,985 |
pacmanager_wrapper
- A universal library for managing packagesA utility to interact with any package manager on any Linux distro
Currently supported:
Taken from examples/install.rs
use pacmanager_wrapper::{execute_action, PacManagerAction, PacManagerCommand};
use futures_lite::{io::BufReader, prelude::*};
#[tokio::main]
async fn main() {
// Create a PacManagerAction
let action = PacManagerAction {
pacmanager_command: PacManagerCommand::Install("lolcat".to_string()), // The action we want to do (which includes the package)
internal_config: Default::default(),
non_interactive: true,
custom_flags: None,
};
// Execute the action with APT and BufRead its output
let mut child = execute_action(action, pacmanager_wrapper::PacManager::Apt).await.unwrap();
let mut lines = BufReader::new(child.stdout.take().unwrap()).lines();
// Print out the PacManager's stdout
while let Some(line) = lines.next().await {
println!("{}", line.unwrap());
}
}