use anyhow::{Result, anyhow};
use std::path::{Path, PathBuf};
use crate::cli::plugin::PluginScopeArg;
pub(super) fn scope_root(repo_root: &Path, scope: PluginScopeArg) -> Result<PathBuf> {
Ok(match scope {
PluginScopeArg::Project => repo_root.join(".ralph/plugins"),
PluginScopeArg::Global => {
let home = std::env::var_os("HOME")
.ok_or_else(|| anyhow!("HOME environment variable not set"))?;
PathBuf::from(home).join(".config/ralph/plugins")
}
})
}
pub(super) fn print_enable_hint(plugin_id: &str) {
println!();
println!("NOTE: The plugin is NOT automatically enabled.");
println!("To enable it, add to your config:");
println!(
r#" {{ "plugins": {{ "plugins": {{ "{}": {{ "enabled": true }} }} }} }}"#,
plugin_id
);
}