Skip to content

Commit

Permalink
feat: upgrade spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
royalpinto007 committed Dec 30, 2023
1 parent 07f7e0d commit a14cc48
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions coffee_cmd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,33 @@ async fn main() -> Result<(), CoffeeError> {
}
CoffeeCommand::Upgrade { repo, verbose } => {
let spinner = if !verbose {
Some(term::spinner("Compiling and installing"))
Some(term::spinner("Upgrading"))
} else {
None
};
match coffee.upgrade(&repo, verbose).await {
Ok(res) => match res.status {
UpgradeStatus::UpToDate => {
term::info!("Remote repository `{}` is already up to date!", res.repo)
Ok(res) => {
if let Some(spinner) = spinner {
spinner.finish();
}
UpgradeStatus::Updated => {
term::success!(
"Remote repository `{}` was successfully upgraded!",
res.repo
)
match res.status {
UpgradeStatus::UpToDate => {
term::info!("Remote repository `{}` is already up to date!", res.repo)
}
UpgradeStatus::Updated => {
term::success!(
"Remote repository `{}` was successfully upgraded!",
res.repo
)
}
}
},
Err(err) => return Err(err),
}
Err(err) => {
if let Some(spinner) = spinner {
spinner.failed();
}
return Err(err);
}
}
Ok(())
}
Expand Down

0 comments on commit a14cc48

Please sign in to comment.