1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! `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());
//! }
//! }
//! ```
pub use PacManagerError;
pub use execute_action;
/// A package. Could be "lolcat", or maybe a specific version such as "lolcat=100.0.1-3" (if the package manager supports it)
pub type Package = String;
/// The package manager to use
/// The specific command to execute - "install", "update", etc.
/// An action of the package manager - the command to execute, custom flags, etc.
/// This is passed to the 'execute_action' function.