Skip to content

Commit 2c06017

Browse files
committed
feat(health): check if bin is in PATH
1 parent a7ca6c0 commit 2c06017

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

soar-cli/src/health.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::path::Path;
1+
use std::{env, path::Path};
22

33
use nu_ansi_term::Color::{Blue, Green, Red};
44
use rusqlite::prepare_and_bind;
@@ -8,11 +8,21 @@ use soar_core::{
88
utils::{desktop_dir, icons_dir, process_dir},
99
SoarResult,
1010
};
11-
use tracing::info;
11+
use tracing::{info, warn};
1212

1313
use crate::{state::AppState, utils::Colored};
1414

1515
pub async fn display_health() -> SoarResult<()> {
16+
let path_env = env::var("PATH")?;
17+
let bin_path = get_config().get_bin_path()?;
18+
if !path_env.split(':').any(|p| Path::new(p) == bin_path) {
19+
warn!(
20+
"{} is not in {1}. Please add it to {1} to use installed binaries.\n",
21+
Colored(Blue, bin_path.display()),
22+
Colored(Green, "PATH")
23+
);
24+
}
25+
1626
list_broken_packages().await?;
1727
println!("");
1828
list_broken_symlinks()?;

0 commit comments

Comments
 (0)