diff --git a/src/main.rs b/src/main.rs index 1b3e89c..b91f946 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,5 +29,13 @@ async fn main() -> Result<(), Box> { #[cfg(feature = "ui")] fn main() -> Result<(), Box> { - ui::run_ui() + + let mut args = std::env::args(); + if args.len() > 1 && args.nth(1).unwrap_or_default() == "--no-ui" { + ui::run_sync(); + Ok(()) + }else{ + ui::run_ui() + + } } diff --git a/src/ui/uiapp.rs b/src/ui/uiapp.rs index d1fa5e3..cb3ca51 100644 --- a/src/ui/uiapp.rs +++ b/src/ui/uiapp.rs @@ -5,7 +5,7 @@ use steam_shortcuts_util::shortcut::ShortcutOwned; use std::error::Error; use tokio::runtime::Runtime; -use crate::{settings::Settings, sync::{download_images, self}, sync::run_sync}; +use crate::{settings::Settings, sync::{download_images, self}, }; use super::{ui_images::{get_import_image, get_logo, get_logo_icon}, ui_colors::{TEXT_COLOR, BACKGROUND_COLOR, BG_STROKE_COLOR, ORANGE, PURLPLE, LIGHT_ORANGE}}; @@ -42,7 +42,7 @@ impl MyEguiApp { MyEguiApp::save_settings_to_file(&settings); //TODO get status back to ui - let usersinfo = run_sync(&settings).unwrap(); + let usersinfo = sync::run_sync(&settings).unwrap(); let task = download_images(&settings, &usersinfo); block_on(task); }); @@ -324,6 +324,11 @@ impl MyEguiApp{ } +pub fn run_sync() { + let app = MyEguiApp::new(); + app.run_sync(); +} + pub fn run_ui() -> Result<(), Box> { let app = MyEguiApp::new();