diff --git a/src/cli/doctor.rs b/src/cli/doctor.rs index 2a575e9e2..f5fda8a72 100644 --- a/src/cli/doctor.rs +++ b/src/cli/doctor.rs @@ -15,7 +15,7 @@ use crate::output::Output; use crate::plugins::PluginType; use crate::shell::ShellType; use crate::toolset::ToolsetBuilder; -use crate::{cli, cmd}; +use crate::{cli, cmd, dirs}; use crate::{duration, env}; /// Check rtx installation for possible problems. @@ -62,12 +62,15 @@ impl Command for Doctor { )); } - if !config.is_activated() { + if !config.is_activated() && !shims_on_path() { let cmd = style("rtx help activate").yellow().for_stderr(); let url = style("https://rtx.pub").underlined().for_stderr(); + let shims = style(dirs::SHIMS.display()).cyan().for_stderr(); checks.push(formatdoc!( r#"rtx is not activated, run {cmd} or - read documentation at {url} for activation instructions"# + read documentation at {url} for activation instructions. + Alternatively, add the shims directory {shims} to PATH. + Using the shims directory is preferred for non-interactive setups."# )); } @@ -87,6 +90,10 @@ impl Command for Doctor { } } +fn shims_on_path() -> bool { + env::PATH.contains(&*dirs::SHIMS) +} + fn rtx_data_dir() -> String { let mut s = style("rtx data directory:\n").bold().to_string(); s.push_str(&format!(" {}\n", env::RTX_DATA_DIR.to_string_lossy()));