mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-07 12:35:00 +00:00
disable adaptive colors when output_mode is list
This commit is contained in:
parent
9e92325bad
commit
ccfee3f418
2 changed files with 15 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue