From 2b19778fd0646a3a4f614b31f04973fd733ad7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Pe=CC=81rez?= Date: Sat, 14 Feb 2026 05:43:21 +0000 Subject: [PATCH] chore: nickel fix for roundtrip --- .../typedialog-core/src/backends/web/mod.rs | 22 ++++++++++++++++++- .../typedialog-core/src/nickel/roundtrip.rs | 5 +++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/crates/typedialog-core/src/backends/web/mod.rs b/crates/typedialog-core/src/backends/web/mod.rs index 9fef194..1de2af1 100644 --- a/crates/typedialog-core/src/backends/web/mod.rs +++ b/crates/typedialog-core/src/backends/web/mod.rs @@ -166,9 +166,29 @@ impl FormBackend for WebBackend { }); self.server_handle = Some(handle); - println!("Web UI available at http://localhost:{}", self.port); + let url = format!("http://localhost:{}", self.port); + println!("Web UI available at {}", url); tokio::time::sleep(Duration::from_millis(500)).await; + // Open browser — best-effort, never fatal. + let url_clone = url.clone(); + tokio::task::spawn_blocking(move || { + #[cfg(target_os = "macos")] + drop(std::process::Command::new("open").arg(&url_clone).status()); + #[cfg(target_os = "linux")] + drop( + std::process::Command::new("xdg-open") + .arg(&url_clone) + .status(), + ); + #[cfg(target_os = "windows")] + drop( + std::process::Command::new("cmd") + .args(["/c", "start", "", &url_clone]) + .status(), + ); + }); + Ok(()) } diff --git a/crates/typedialog-core/src/nickel/roundtrip.rs b/crates/typedialog-core/src/nickel/roundtrip.rs index 20dd6e3..742744b 100644 --- a/crates/typedialog-core/src/nickel/roundtrip.rs +++ b/crates/typedialog-core/src/nickel/roundtrip.rs @@ -380,8 +380,9 @@ impl RoundtripConfig { // Extract base directory for resolving relative paths (includes, fragments) let base_dir = form_path.parent().unwrap_or_else(|| Path::new(".")); - // Execute form using provided backend (TUI, Web, or CLI) with defaults - form_parser::execute_with_backend_two_phase_with_defaults( + // execute_with_backend_i18n_with_defaults dispatches on display_mode, + // handling both field-by-field (CLI) and complete-form (Web) correctly. + form_parser::execute_with_backend_i18n_with_defaults( form, backend, None,