Skip to content

Commit d54d553

Browse files
author
Chris
committed
added local upgrade command
1 parent 662674c commit d54d553

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/commands/local.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,26 @@ pub async fn handle_stop() -> Result<(), Box<dyn std::error::Error>> {
227227
}
228228

229229
pub async fn handle_upgrade() -> Result<(), Box<dyn std::error::Error>> {
230-
println!("{} Upgrading local Canine environment...", "→".cyan());
230+
if !docker_compose_path().exists() {
231+
println!("{} Local Canine environment is not installed", "✗".red());
232+
println!(" Run {} to install", "canine local start".cyan());
233+
std::process::exit(1);
234+
}
235+
236+
println!("{} Pulling latest images...", "→".cyan());
237+
238+
let status = Command::new("docker")
239+
.args(["compose", "pull"])
240+
.current_dir(local_dir())
241+
.status()?;
242+
243+
if status.success() {
244+
println!("{} Images updated successfully", "✓".green());
245+
println!(" Run {} to apply the upgrade", "canine local start".cyan());
246+
} else {
247+
println!("{} Failed to pull images", "✗".red());
248+
std::process::exit(1);
249+
}
250+
231251
Ok(())
232252
}

0 commit comments

Comments
 (0)