diff --git a/src/commands/init/mod.rs b/src/commands/init/mod.rs index 0098d7b..4ee9b34 100644 --- a/src/commands/init/mod.rs +++ b/src/commands/init/mod.rs @@ -16,8 +16,16 @@ pub mod keys; pub mod path_setup; pub mod repositories; +use std::io::ErrorKind; use tracing::{info, warn}; +/// Create a friendly error for missing Docker CLI. +fn docker_not_found_error() -> Box { + "Docker CLI not found. Install Docker and ensure the 'docker' command is on PATH, then re-run 'foc-devnet init'." + .to_string() + .into() +} + /// Clean up previous foc-devnet installation. /// /// Removes the entire ~/.foc-devnet directory and optionally all foc-* Docker @@ -50,7 +58,11 @@ fn cleanup_previous_installation(remove_images: bool) -> Result<(), Box docker_not_found_error(), + _ => err.into(), + })?; if output.status.success() { let stdout = String::from_utf8_lossy(&output.stdout); @@ -59,7 +71,13 @@ fn cleanup_previous_installation(remove_images: bool) -> Result<(), Box docker_not_found_error(), + _ => err.into(), + })?; if remove_output.status.success() { removed_count += 1;