Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
karminski committed Oct 25, 2023
2 parents 1eda57c + f40ddb0 commit a23306f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
7 changes: 5 additions & 2 deletions src/command/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,14 @@ async fn deploy_self_host(
let _docker = Docker::connect_with_local_defaults().unwrap();
if (_docker.ping().await).is_err() {
println!(
"{} {}\n{} {}",
"{} {}\n{} {}\n\n{}\n\n{}\n\n{}\n",
ui::emoji::FAIL,
String::from("No running docker found."),
ui::emoji::WARN,
style("Please check the status of docker.").red(),
style("Please check the status of docker with command: docker info").red(),
String::from("If you do not have Docker installed, please refer to the following content for instructions on how to install it: "),
style("https://docs.docker.com/engine/install/").blue(),
String::from("Once Docker is installed, please try running the command again."),
);
process::exit(1);
}
Expand Down
21 changes: 14 additions & 7 deletions src/command/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ impl Cmd {
let new_spinner_style = ProgressStyle::with_template("{wide_msg}").unwrap();
pb.set_style(new_spinner_style);
let _docker = Docker::connect_with_local_defaults().unwrap();
let error_info = |pb: ProgressBar| {
pb.println(format!(
"{} {}\n{} {}\n\n{}\n\n{}\n\n{}\n",
ui::emoji::FAIL,
String::from("No running docker found."),
ui::emoji::WARN,
style("Please check the status of docker with command: docker info").red(),
String::from("If you do not have Docker installed, please refer to the following content for instructions on how to install it: "),
style("https://docs.docker.com/engine/install/").blue(),
String::from("Once Docker is installed, please try running the command again."),
));
pb.finish_with_message(format!("illa doctor exited."));
};
match _docker.version().await {
Ok(version) => pb.finish_with_message(format!(
"{} {}: {}\n{} {}",
Expand All @@ -44,13 +57,7 @@ impl Cmd {
ui::emoji::SPARKLE,
style("Success! The minimum requirement for deploying ILLA has been satisfied. Self-Host your ILLA Builder by command [illa deploy].").green(),
)),
Err(e) => pb.finish_with_message(format!(
"{} {}\n{} {}",
ui::emoji::FAIL,
String::from("No running docker found."),
ui::emoji::WARN,
style("Please check the status of docker.").red(),
))
Err(e) => error_info(pb),
}
println!();
Ok(())
Expand Down
7 changes: 5 additions & 2 deletions src/command/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ async fn remove_local(is_force: bool, data: bool) -> Result {
let _docker = Docker::connect_with_local_defaults().unwrap();
if (_docker.ping().await).is_err() {
println!(
"{} {}\n{} {}",
"{} {}\n{} {}\n\n{}\n\n{}\n\n{}\n",
ui::emoji::FAIL,
String::from("No running docker found."),
ui::emoji::WARN,
style("Please check the status of docker.").red(),
style("Please check the status of docker with command: docker info").red(),
String::from("If you do not have Docker installed, please refer to the following content for instructions on how to install it: "),
style("https://docs.docker.com/engine/install/").blue(),
String::from("Once Docker is installed, please try running the command again."),
);
process::exit(1);
}
Expand Down
7 changes: 5 additions & 2 deletions src/command/restart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ async fn restart_local() -> Result {
let _docker = Docker::connect_with_local_defaults().unwrap();
if (_docker.ping().await).is_err() {
println!(
"{} {}\n{} {}",
"{} {}\n{} {}\n\n{}\n\n{}\n\n{}\n",
ui::emoji::FAIL,
String::from("No running docker found."),
ui::emoji::WARN,
style("Please check the status of docker.").red(),
style("Please check the status of docker with command: docker info").red(),
String::from("If you do not have Docker installed, please refer to the following content for instructions on how to install it: "),
style("https://docs.docker.com/engine/install/").blue(),
String::from("Once Docker is installed, please try running the command again."),
);
process::exit(1);
}
Expand Down
7 changes: 5 additions & 2 deletions src/command/stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ async fn stop_local() -> Result {
let _docker = Docker::connect_with_local_defaults().unwrap();
if (_docker.ping().await).is_err() {
println!(
"{} {}\n{} {}",
"{} {}\n{} {}\n\n{}\n\n{}\n\n{}\n",
ui::emoji::FAIL,
String::from("No running docker found."),
ui::emoji::WARN,
style("Please check the status of docker.").red(),
style("Please check the status of docker with command: docker info").red(),
String::from("If you do not have Docker installed, please refer to the following content for instructions on how to install it: "),
style("https://docs.docker.com/engine/install/").blue(),
String::from("Once Docker is installed, please try running the command again."),
);
process::exit(1);
}
Expand Down
7 changes: 5 additions & 2 deletions src/command/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ async fn update_local(progress_style: ProgressStyle) -> Result {
let _docker = Docker::connect_with_local_defaults().unwrap();
if (_docker.ping().await).is_err() {
println!(
"{} {}\n{} {}",
"{} {}\n{} {}\n\n{}\n\n{}\n\n{}\n",
ui::emoji::FAIL,
String::from("No running docker found."),
ui::emoji::WARN,
style("Please check the status of docker.").red(),
style("Please check the status of docker with command: docker info").red(),
String::from("If you do not have Docker installed, please refer to the following content for instructions on how to install it: "),
style("https://docs.docker.com/engine/install/").blue(),
String::from("Once Docker is installed, please try running the command again."),
);
process::exit(1);
}
Expand Down

0 comments on commit a23306f

Please sign in to comment.