mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-14 04:12:08 +00:00
Add fabro-static::EnvVars as the shared registry for fixed environment variable names and migrate env reads, clap env bindings, and subprocess/test allowlists to use it. Add clippy bans for raw std::env lookup APIs so future dynamic env facades must be documented explicitly.
16 lines
569 B
Rust
16 lines
569 B
Rust
use fabro_static::EnvVars;
|
|
|
|
/// When this environment variable is set to any value, [`try_open`] returns
|
|
/// `Ok(())` without launching a browser. Test harnesses set it so spawned
|
|
/// `fabro` subprocesses do not pop real browser windows during CI or local
|
|
/// runs.
|
|
#[expect(
|
|
clippy::disallowed_methods,
|
|
reason = "Browser launching checks the documented process-env escape hatch."
|
|
)]
|
|
pub fn try_open(url: &str) -> std::io::Result<()> {
|
|
if std::env::var_os(EnvVars::FABRO_SUPPRESS_OPEN_BROWSER).is_some() {
|
|
return Ok(());
|
|
}
|
|
open::that(url)
|
|
}
|