chore: nickel fix for roundtrip

This commit is contained in:
Jesús Pérez 2026-02-14 05:43:21 +00:00
parent 16d7a7c442
commit 2b19778fd0
Signed by: jesus
GPG Key ID: 9F243E355E0BC939
2 changed files with 24 additions and 3 deletions

View File

@ -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(())
}

View File

@ -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,