Add an --no-ui option to the ui version

The UI verison will just perform a sync as if it was the cli version
This commit is contained in:
Philip Kristoffersen
2022-04-13 15:30:15 +02:00
parent 6169f9b235
commit 6ee0da5663
2 changed files with 16 additions and 3 deletions
+8
View File
@@ -29,5 +29,13 @@ async fn main() -> Result<(), Box<dyn Error>> {
#[cfg(feature = "ui")] #[cfg(feature = "ui")]
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
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() ui::run_ui()
}
} }
+7 -2
View File
@@ -5,7 +5,7 @@ use steam_shortcuts_util::shortcut::ShortcutOwned;
use std::error::Error; use std::error::Error;
use tokio::runtime::Runtime; 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}}; 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); MyEguiApp::save_settings_to_file(&settings);
//TODO get status back to ui //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); let task = download_images(&settings, &usersinfo);
block_on(task); 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<dyn Error>> { pub fn run_ui() -> Result<(), Box<dyn Error>> {
let app = MyEguiApp::new(); let app = MyEguiApp::new();