1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::shell;
use clap_complete::Shell;
use log::info;
use proto_core::{color, ProtoError};
use rustc_hash::FxHashMap;
pub fn post_install(passthrough: &[String]) -> Result<(), ProtoError> {
if passthrough.contains(&"--no-gobin".to_string()) {
return Ok(());
}
let shell = Shell::from_env().unwrap_or(Shell::Bash);
let env_vars = FxHashMap::from_iter([
("GOBIN".to_string(), "$HOME/go/bin".to_string()),
("PATH".to_string(), "$GOBIN".to_string()),
]);
if let Some(content) = shell::format_env_vars(&shell, "go", env_vars) {
if let Some(updated_profile) = shell::write_profile_if_not_setup(&shell, content, "GOBIN")?
{
info!(
target: "proto:install", "Added GOBIN to your shell profile {}",
color::path(updated_profile)
);
}
}
Ok(())
}