mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-22 07:43:39 +01:00
Expose theme env vars
This commit is contained in:
parent
e075fee5bf
commit
60e4027332
@ -140,9 +140,9 @@ fn get_args_from_str(content: &str) -> Result<Vec<OsString>, shell_words::ParseE
|
||||
pub fn get_args_from_env_vars() -> Vec<OsString> {
|
||||
[
|
||||
("--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"),
|
||||
|
10
src/theme.rs
10
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.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user