summaryrefslogtreecommitdiffstats
path: root/ozone-cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'ozone-cli/src')
-rw-r--r--ozone-cli/src/main.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/ozone-cli/src/main.rs b/ozone-cli/src/main.rs
index dda2c32..05fef49 100644
--- a/ozone-cli/src/main.rs
+++ b/ozone-cli/src/main.rs
@@ -8,6 +8,7 @@ use std::time::Duration;
use log::{error, info, trace};
use clap::Parser;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
+use indicatif_log_bridge::LogWrapper;
use ozone::launcher::{Instance, JavaRuntimeSetting, LaunchProgress, Launcher, ProgressIndication, Settings, ALT_CLIENT_ID, MAIN_CLIENT_ID};
use ozone::launcher::version::{VersionList, VersionResult};
use uuid::Uuid;
@@ -156,7 +157,7 @@ fn display_account(account: &Account, selected: bool, verbose: bool) {
}
}
-async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
+async fn main_inner(cli: Cli, multi: MultiProgress) -> Result<ExitCode, Box<dyn Error>> {
let Some(home) = cli.home.or_else(Launcher::sensible_home) else {
error!("Could not choose a launcher home directory. Please choose one with `--home'.");
return Ok(ExitCode::FAILURE); // we print our own error message
@@ -515,17 +516,18 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
println!("Preparing the game files...");
let launcher = Launcher::new(&home, !cli.offline).await?;
- let multi = MultiProgress::new();
let progress = IndicatifProgress {
bar: multi.add(ProgressBar::no_length()
.with_style(ProgressStyle::with_template("{spinner} Step {pos} of {len}: {msg}").unwrap()))
};
let progress_sub = IndicatifProgress {
- bar: multi.add(ProgressBar::no_length())
+ bar: multi.add(ProgressBar::no_length()
+ .with_style(ProgressStyle::with_template("{bar} {pos}/{len}: {msg}").unwrap()))
};
progress.bar.enable_steady_tick(Duration::from_millis(100));
+ progress_sub.bar.enable_steady_tick(Duration::from_millis(50));
let lp = LaunchProgress::new(&progress as &dyn ProgressIndication, &progress_sub as &dyn ProgressIndication);
@@ -541,6 +543,9 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
info!("ok!");
+ progress.bar.finish();
+ progress_sub.bar.finish();
+ multi.clear().unwrap();
println!("Launching the game!");
ozone::launcher::run_the_game(&launch)?;
@@ -553,11 +558,12 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
#[tokio::main]
async fn main() -> ExitCode {
// use Warn as the default level to minimize noise on the command line
- //simple_logger::SimpleLogger::new().env().init().unwrap();
+ let progress = MultiProgress::new();
+ LogWrapper::new(progress.clone(), simple_logger::SimpleLogger::new().env()).try_init().unwrap();
let arg = Cli::parse();
- main_inner(arg).await.unwrap_or_else(|e| {
+ main_inner(arg, progress).await.unwrap_or_else(|e| {
error!("Launcher initialization error:");
error!("{e}");