diff --git a/cli/app.rs b/cli/app.rs index 376be0bd3..f6cec8687 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -151,6 +151,7 @@ impl Limbo { } let sql = opts.sql.clone(); let quiet = opts.quiet; + let config = Config::for_output_mode(opts.output_mode); let mut app = Self { prompt: PROMPT.to_string(), io, @@ -160,7 +161,7 @@ impl Limbo { input_buff: String::new(), opts: Settings::from(opts), rl: None, - config: Some(Config::default()), + config: Some(config), }; app.first_run(sql, quiet)?; Ok(app) diff --git a/cli/config/mod.rs b/cli/config/mod.rs index 54bde4e4f..38003e0f7 100644 --- a/cli/config/mod.rs +++ b/cli/config/mod.rs @@ -1,6 +1,7 @@ mod palette; mod terminal; +use crate::input::OutputMode; use crate::HOME_DIR; use nu_ansi_term::Color; use palette::LimboColor; @@ -79,6 +80,18 @@ impl Config { None } } + + pub fn for_output_mode(mode: OutputMode) -> Self { + let table = if mode == OutputMode::Pretty { + TableConfig::adaptive_colors() + } else { + TableConfig::no_colors() + }; + Self { + table, + highlight: HighlightConfig::default(), + } + } } #[derive(Debug, Deserialize, Clone, JsonSchema, Validate)]