diff --git a/src/bin/bat/config.rs b/src/bin/bat/config.rs index f1ec3d53..a0ee7ba3 100644 --- a/src/bin/bat/config.rs +++ b/src/bin/bat/config.rs @@ -140,9 +140,9 @@ fn get_args_from_str(content: &str) -> Result, shell_words::ParseE pub fn get_args_from_env_vars() -> Vec { [ ("--tabs", "BAT_TABS"), - ("--theme", "BAT_THEME"), - ("--theme-dark", "BAT_THEME_DARK"), - ("--theme-light", "BAT_THEME_LIGHT"), + ("--theme", bat::theme::env::BAT_THEME), + ("--theme-dark", bat::theme::env::BAT_THEME_DARK), + ("--theme-light", bat::theme::env::BAT_THEME_LIGHT), ("--pager", "BAT_PAGER"), ("--paging", "BAT_PAGING"), ("--style", "BAT_STYLE"), diff --git a/src/theme.rs b/src/theme.rs index 41ce84e1..0276e5e0 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -5,6 +5,16 @@ use std::fmt; use std::io::IsTerminal as _; use std::str::FromStr; +/// Environment variable names. +pub mod env { + /// See [`crate::theme::ThemeOptions::theme`]. + pub const BAT_THEME: &str = "BAT_THEME"; + /// See [`crate::theme::ThemeOptions::theme_dark`]. + pub const BAT_THEME_DARK: &str = "BAT_THEME"; + /// See [`crate::theme::ThemeOptions::theme_light`]. + pub const BAT_THEME_LIGHT: &str = "BAT_THEME"; +} + /// Chooses an appropriate theme or falls back to a default theme /// based on the user-provided options and the color scheme of the terminal. ///