feat(qconnect): parse --enable-qconnect / --disable-qconnect CLI flags

Volatile per-launch override. Both flags together → enable wins
deterministically with a warn log. The override is threaded into
lib::run() and consumed in the next task.

cc
This commit is contained in:
vicrodh committed 2026-05-01 12:20:35 -06:00
1 parent 40851ad58e
commit 27cb2ab6cc
2 files changed
+17 -2

No files matched your search

+1 -1
View File
@@ -495,7 +495,7 @@ fn handle_qobuz_link(handle: &tauri::AppHandle, url: &str, delay: bool) {
}
}
pub fn run() {
pub fn run(_qconnect_cli_override: Option<bool>) {
// Load .env file if present (for development)
// Silently ignore if not found (production builds use compile-time env vars)
dotenvy::dotenv().ok();
+16 -1
View File
@@ -542,8 +542,23 @@ fn main() {
qbz_nix_lib::logging::log_startup(&format!("[QBZ] GPU rendering: {}", gpu_status));
}
// CLI flags: --enable-qconnect / --disable-qconnect (volatile per-launch override)
let qconnect_force_on = std::env::args().any(|a| a == "--enable-qconnect");
let qconnect_force_off = std::env::args().any(|a| a == "--disable-qconnect");
let qconnect_cli_override: Option<bool> = match (qconnect_force_on, qconnect_force_off) {
(true, false) => Some(true),
(false, true) => Some(false),
(true, true) => {
log::warn!(
"[QConnect] Both --enable-qconnect and --disable-qconnect provided; --enable-qconnect wins"
);
Some(true)
}
(false, false) => None,
};
// Catch panics during startup and show a recovery message
let result = std::panic::catch_unwind(|| qbz_nix_lib::run());
let result = std::panic::catch_unwind(|| qbz_nix_lib::run(qconnect_cli_override));
if let Err(panic_info) = result {
let msg = if let Some(s) = panic_info.downcast_ref::<String>() {