Skip to content

Commit

Permalink
testing self-update
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Aug 3, 2024
1 parent 2d2d188 commit 84e8635
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "khost"
version = "0.0.12"
version = "0.0.13"
edition = "2021"
authors = ["Kaspa developers"]
license = "MIT OR Apache-2.0"
Expand Down
12 changes: 6 additions & 6 deletions src/khost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ pub fn update() -> Result<()> {
if is_cargo_install() {
if let Ok(latest_version) = version::blocking::latest_crate_version("khost", "khost") {
if latest_version.is_greater_than(version()) {
log::warning(format!("New version of khost@{latest_version} detected"))?;
log::warning(format!("New version of kHOST@{latest_version} detected"))?;
if confirm("Would you like to update?")
.initial_value(true)
.interact()?
{
log::info(format!("Updating khost to {latest_version}"))?;
cmd!("cargo", "install", format!("khost@{latest_version}")).run()?;
log::success(format!("khost updated to {latest_version}"))?;
step(format!("Updating kHOST to {latest_version}"), || {
cmd!("cargo", "install", format!("khost@{latest_version}")).run()
})?;
log::success(format!("kHOST updated to {latest_version}"))?;
log::info("(if khost exits, please restart it)")?;
outro("Starting new version...")?;
println!();
Expand All @@ -39,7 +40,6 @@ pub fn update() -> Result<()> {
}

pub fn surrender() {
let current_exe = std::env::current_exe().unwrap();
let _ = duct::cmd!(current_exe).run();
let _ = duct::cmd!("khost").run();
std::process::exit(0);
}

0 comments on commit 84e8635

Please sign in to comment.