This repository has been archived by the owner on May 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(arg,deps): fixed spinner on conflict detect // subcommand to che…
…ck for installed pkgs
- Loading branch information
Showing
7 changed files
with
75 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,29 @@ | ||
use crate::engine::dirs; | ||
use std::fs; | ||
use std::io; | ||
use std::path::Path; | ||
use std::sync::Arc; | ||
|
||
pub fn print_installed_pkgs() -> Result<(), anyhow::Error> { | ||
let installed_pkgs = get_installed_pkgs()?; | ||
for pkg in installed_pkgs.iter() { | ||
println!("{}", pkg); | ||
} | ||
Ok(()) | ||
} | ||
|
||
fn get_installed_pkgs() -> Result<Arc<Vec<String>>, io::Error> { | ||
let bin_dir: &Path = dirs::HYSP_BIN_DIR.as_ref(); | ||
let mut binaries = Vec::new(); | ||
|
||
if let Ok(entries) = fs::read_dir(bin_dir) { | ||
for entry in entries { | ||
if let Ok(entry) = entry { | ||
if let Some(file_name) = entry.file_name().to_str() { | ||
binaries.push(file_name.to_string()); | ||
} | ||
} | ||
} | ||
} | ||
Ok(Arc::new(binaries)) | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod install; | ||
pub mod list; | ||
pub mod search; | ||
pub mod uninstall; | ||
|
||
|
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
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