-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add xbps package manager to
packages
block (#2136)
* Add support for xbps package manager * Add `xbps` to cspell --------- Co-authored-by: TheWalkingForest <[email protected]>
- Loading branch information
1 parent
27bd364
commit 0afe30d
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,6 +183,7 @@ words: | |
- wlsunset | ||
- wofi | ||
- wttr | ||
- xbps | ||
- xclip | ||
- xcolors | ||
- xesam | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use tokio::process::Command; | ||
|
||
use super::*; | ||
|
||
#[derive(Default)] | ||
pub struct Xbps; | ||
|
||
impl Xbps { | ||
pub fn new() -> Self { | ||
Default::default() | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl Backend for Xbps { | ||
fn name(&self) -> Cow<'static, str> { | ||
"xbps".into() | ||
} | ||
|
||
async fn get_updates_list(&self) -> Result<Vec<String>> { | ||
let stdout = Command::new("xbps-install") | ||
.env("LC_LANG", "C") | ||
.args(["-M", "-u", "-n"]) | ||
.output() | ||
.await | ||
.error("Problem running xbps-install command")? | ||
.stdout; | ||
|
||
let updates = String::from_utf8(stdout).expect("xbps-install produced non-UTF8 output"); | ||
let updates_list: Vec<String> = updates | ||
.lines() | ||
.filter(|line| line.len() > 1) | ||
.map(|line| line.to_string()) | ||
.collect(); | ||
|
||
Ok(updates_list) | ||
} | ||
} |