Skip to content

Commit

Permalink
Improve self-install output
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptibell committed Mar 26, 2024
1 parent 9679e70 commit f6a947f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/cli/self_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,38 @@ impl SelfInstallSubcommand {

let (had_rokit_installed, was_rokit_updated) = storage.recreate_all_links().await.context(
"Failed to recreate tool links!\
\nYour installation may be corrupted.",
\nYour installation may be corrupted.",
)?;

// TODO: Automatically populate the PATH variable
// TODO: Try to automatically populate the PATH variable
let path_was_populated = false;
let path_message_lines = if !path_was_populated {
"\n\nBinaries for Rokit and tools have been added to your PATH.\
\nPlease restart your terminal for the changes to take effect."
format!(
"\n\nExecutables for Rokit and tools have been added to {}.\
\nPlease restart your terminal for the changes to take effect.",
style("$PATH").bold()
)
} else {
""
String::new()
};

let main_message = if !had_rokit_installed {
"Rokit has been installed successfully!"
} else if was_rokit_updated {
"Rokit was re-linked successfully!"
} else {
"Rokit is already up-to-date."
"Rokit links are already up-to-date."
};

let help_message = style("rokit --help").bold().green();
let post_message = if !path_was_populated {
format!("\n\nThen, run `{help_message}` to get started using Rokit.")
} else {
format!("\n\nRun `{help_message}` to get started using Rokit.")
};

let msg = format!(
"{main_message} {}{path_message_lines}",
"{main_message} {}{path_message_lines}{post_message}",
style(format!("(took {:.2?})", pb.elapsed())).dim(),
);
finish_progress_bar(pb, msg);
Expand Down

0 comments on commit f6a947f

Please sign in to comment.