Skip to content

Commit

Permalink
Print a message with a shell line to add bindir to PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
coolreader18 authored and John Detter committed Feb 28, 2025
1 parent cf5e4ad commit ab19ee2
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions crates/update/src/cli/self_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,31 @@ impl SelfInstall {
}

eprintln!(
"\
The `spacetime` command has been installed as {cli_bin_file}
Note: we recommend making sure that this executable is in your PATH variable.
"The `spacetime` command has been installed as {}",
cli_bin_file.display()
);
eprintln!();

if cfg!(unix) {
let path_var = std::env::var_os("PATH").unwrap_or_default();
let bin_dir = cli_bin_file.0.parent().unwrap();
if !std::env::split_paths(&path_var).any(|p| p == bin_dir) {
eprintln!(
r#"\
It seems like this directory is not in your `PATH` variable. Please add the
following line to your shell configuration and open a new shell session:
export PATH="{}:$PATH"
"#,
bin_dir.display()
)
}
}

eprintln!(
"\
The install process is complete; check out our quickstart guide to get started!
<https://spacetimedb.com/docs/quick-start>",
cli_bin_file = cli_bin_file.display()
<https://spacetimedb.com/docs/quick-start>"
);

Ok(ExitCode::SUCCESS)
Expand Down

0 comments on commit ab19ee2

Please sign in to comment.