Skip to content

Commit

Permalink
feat: displays current version if rover is up to date (#408)
Browse files Browse the repository at this point in the history
Co-authored-by: Irina Shestak <[email protected]>
  • Loading branch information
EverlastingBugstopper and lrlna authored Apr 6, 2021
1 parent 777bcf2 commit 5a9f5ba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utils/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ pub fn check_for_update(config: config::Config, force: bool) -> Result<()> {

fn do_update_check(checked: &mut bool, should_output_if_updated: bool) -> Result<()> {
let latest = get_latest_release()?;
let pretty_latest = Cyan.normal().paint(format!("v{}", latest));
let update_available = is_latest_newer(&latest, PKG_VERSION)?;

if update_available {
let message = format!(
"There is a newer version of Rover available: {} (currently running v{})\n\nFor instructions on how to install, run {}",
Cyan.normal().paint(format!("v{}", latest)),
&pretty_latest,
PKG_VERSION,
Yellow.normal().paint("`rover docs open start`")
);
Expand All @@ -67,7 +67,10 @@ fn do_update_check(checked: &mut bool, should_output_if_updated: bool) -> Result
.build()
.eprint(message);
} else if should_output_if_updated {
eprintln!("Rover is up to date!");
eprintln!(
"Rover is up to date with the latest release {}.",
&pretty_latest
);
}

*checked = true;
Expand Down

0 comments on commit 5a9f5ba

Please sign in to comment.