initial version
This commit is contained in:
31
src/main.rs
Normal file
31
src/main.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use alhp_api;
|
||||
use std::process::Command;
|
||||
use alhp_api::{PackageRequest, PackageStatus};
|
||||
|
||||
fn pacman_query_installed_packages() -> Vec<String> {
|
||||
match Command::new("pacman").arg("-Qqn").output() {
|
||||
Ok(packages) => String::from_utf8_lossy(&packages.stdout)
|
||||
.lines()
|
||||
.map(|s| s.to_string())
|
||||
.collect(),
|
||||
_ => {
|
||||
panic!("pacman query failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let installed_packages = pacman_query_installed_packages();
|
||||
println!("installed packages: {:?}", installed_packages);
|
||||
let status = vec!();
|
||||
let pkg = PackageRequest{
|
||||
status,
|
||||
pkgbase: Some("go".to_string()),
|
||||
exact: true,
|
||||
repo: Some("extra-x86-64-v3".to_string()),
|
||||
offset: 0,
|
||||
limit: 0,
|
||||
};
|
||||
let pkg = pkg.response().unwrap();
|
||||
println!("pkg: {:?}", pkg);
|
||||
}
|
||||
Reference in New Issue
Block a user