Skip to content

Commit 64a5a93

Browse files
committed
refactor(ui): remove env overrides for ui settings
Why: - env toggles for alt-screen and theme were requested to be removed - keep UI behavior consistent across environments Impact: - INTAR_* theme/alt-screen env overrides no longer apply - Tests: just check
1 parent a432764 commit 64a5a93

2 files changed

Lines changed: 2 additions & 47 deletions

File tree

crates/intar-ui/src/app.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,7 @@ enum AltScreenMode {
169169

170170
impl AltScreenMode {
171171
fn from_env() -> Self {
172-
if use_alt_screen_from_env() {
173-
Self::Enabled
174-
} else {
175-
Self::Disabled
176-
}
172+
Self::Enabled
177173
}
178174

179175
fn enabled(self) -> bool {
@@ -234,7 +230,7 @@ impl App {
234230
agent_binary_aarch64: Vec<u8>,
235231
) -> Self {
236232
let now = Instant::now();
237-
let theme_settings = ThemeSettings::from_env();
233+
let theme_settings = ThemeSettings::resolve();
238234
Self {
239235
scenario,
240236
runner: None,
@@ -1058,22 +1054,6 @@ fn restore_terminal(
10581054
Ok(())
10591055
}
10601056

1061-
fn use_alt_screen_from_env() -> bool {
1062-
if env_flag("INTAR_NO_ALT_SCREEN") == Some(true) {
1063-
return false;
1064-
}
1065-
env_flag("INTAR_ALT_SCREEN").unwrap_or(true)
1066-
}
1067-
1068-
fn env_flag(key: &str) -> Option<bool> {
1069-
let value = std::env::var(key).ok()?;
1070-
match value.trim().to_ascii_lowercase().as_str() {
1071-
"1" | "true" | "yes" | "on" => Some(true),
1072-
"0" | "false" | "no" | "off" => Some(false),
1073-
_ => None,
1074-
}
1075-
}
1076-
10771057
fn detect_arch() -> String {
10781058
#[cfg(target_arch = "x86_64")]
10791059
return "x86_64".to_string();

crates/intar-ui/src/colors.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ impl Default for Theme {
6060
}
6161

6262
impl ThemeSettings {
63-
#[must_use]
64-
pub fn from_env() -> Self {
65-
let color_level = ColorLevel::detect();
66-
let mode = ThemeMode::from_env_override().unwrap_or(ThemeMode::Dark);
67-
Self { mode, color_level }
68-
}
69-
7063
#[must_use]
7164
pub fn resolve() -> Self {
7265
let color_level = ColorLevel::detect();
@@ -76,17 +69,8 @@ impl ThemeSettings {
7669
}
7770

7871
impl ThemeMode {
79-
#[must_use]
80-
fn from_env_override() -> Option<Self> {
81-
env_theme_override("INTAR_THEME").or_else(|| env_theme_override("CLITHEME"))
82-
}
83-
8472
#[must_use]
8573
fn resolve(color_level: ColorLevel) -> Self {
86-
if let Some(mode) = Self::from_env_override() {
87-
return mode;
88-
}
89-
9074
if color_level == ColorLevel::None {
9175
return ThemeMode::Dark;
9276
}
@@ -324,15 +308,6 @@ fn palette_light_ansi16() -> ThemePalette {
324308
}
325309
}
326310

327-
fn env_theme_override(var: &str) -> Option<ThemeMode> {
328-
let value = env::var(var).ok()?;
329-
match value.trim().to_ascii_lowercase().as_str() {
330-
"dark" => Some(ThemeMode::Dark),
331-
"light" => Some(ThemeMode::Light),
332-
_ => None,
333-
}
334-
}
335-
336311
fn detect_theme_mode() -> Option<ThemeMode> {
337312
if !io::stdin().is_tty() || !io::stdout().is_tty() {
338313
return None;

0 commit comments

Comments
 (0)