Expand description
pacmanager_wrapper
is a utility to interact with any package manager on any Linux distro
Example usage:
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());
}
}
Structs§
- Internal
Config - PacManager
Action - An action of the package manager - the command to execute, custom flags, etc. This is passed to the ‘execute_action’ function.
Enums§
- PacManager
- The package manager to use
- PacManager
Command - The specific command to execute - “install”, “update”, etc.
- PacManager
Error - An error which could be returned while doing an action
Functions§
- execute_
action - Executes the specified action.
Returns a
Child
object to the pacmanager’s process.
Type Aliases§
- Package
- A package. Could be “lolcat”, or maybe a specific version such as “lolcat=100.0.1-3” (if the package manager supports it)