Skip to content

Commit

Permalink
feat: Improved self-update UX with more details (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
FroVolod authored Dec 6, 2023
1 parent afd0f00 commit a218450
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/commands/extensions/self_update/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const BIN_NAME: &str = "near.exe";
#[cfg(not(windows))]
const BIN_NAME: &str = "near";

use color_eyre::eyre::WrapErr;
use color_eyre::{eyre::WrapErr, owo_colors::OwoColorize};

#[derive(Debug, Clone, interactive_clap::InteractiveClap)]
#[interactive_clap(input_context = crate::GlobalContext)]
Expand All @@ -18,7 +18,7 @@ impl SelfUpdateCommandContext {
_previous_context: crate::GlobalContext,
_scope: &<SelfUpdateCommand as interactive_clap::ToInteractiveClapContextScope>::InteractiveClapContextScope,
) -> color_eyre::eyre::Result<Self> {
self_update::backends::github::Update::configure()
let status = self_update::backends::github::Update::configure()
.repo_owner("near")
.repo_name("near-cli-rs")
.bin_path_in_archive(
Expand All @@ -31,6 +31,23 @@ impl SelfUpdateCommandContext {
.wrap_err("Failed to build self_update")?
.update()
.wrap_err("Failed to update near CLI")?;
if let self_update::Status::Updated(release) = status {
println!(
"\n{}{}{}\n",
"Welcome to `near` CLI v".green().bold(),
release.green().bold(),
"!".green().bold()
);
println!("Report any bugs:\n");
println!("\thttps://github.com/near/near-cli-rs/issues\n");
println!("What's new:\n");
println!(
"\t{}{}\n",
"https://github.com/near/near-cli-rs/releases/tag/v".truecolor(0, 160, 150),
release.truecolor(0, 160, 150)
);
}

Ok(Self)
}
}
Expand Down

0 comments on commit a218450

Please sign in to comment.