Skip to content

Commit

Permalink
update the license
Browse files Browse the repository at this point in the history
  • Loading branch information
wangenius committed Dec 23, 2024
1 parent 63264c2 commit e1d96e5
Show file tree
Hide file tree
Showing 2 changed files with 18 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.

24 changes: 17 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ async fn main() -> Result<()> {
}
}

// 将别名参数添加���命令中
// 将别名参数添加到命令中
for arg in alias_args {
cmd = cmd.arg(arg);
}
Expand Down Expand Up @@ -572,17 +572,27 @@ async fn main() -> Result<()> {
}
}
Some(("update", _)) => {
println!("Checking for updates...");
println!("checking for updates...");
match check_update().await? {
Some(version) => {
println!("New version {} available! (current: {})", version.green(), CURRENT_VERSION);
println!("Downloading and installing update...");
if let Err(e) = download_and_replace(&version).await {
println!("Failed to update: {}", e);
println!("new version {} (current: {})", version.green(), CURRENT_VERSION);
print!("update to new version? [y/N] ");
io::stdout().flush()?;

let mut input = String::new();
io::stdin().read_line(&mut input)?;

if input.trim().to_lowercase() == "y" {
println!("downloading and installing update...");
if let Err(e) = download_and_replace(&version).await {
println!("update failed: {}", e);
}
} else {
println!("update cancelled");
}
}
None => {
println!("You are already using the latest version ({})", CURRENT_VERSION.green());
println!("you are already using the latest version ({})", CURRENT_VERSION.green());
}
}
}
Expand Down

0 comments on commit e1d96e5

Please sign in to comment.