mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-07 20:45:01 +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 sql = opts.sql.clone();
|
||||||
let quiet = opts.quiet;
|
let quiet = opts.quiet;
|
||||||
|
let config = Config::for_output_mode(opts.output_mode);
|
||||||
let mut app = Self {
|
let mut app = Self {
|
||||||
prompt: PROMPT.to_string(),
|
prompt: PROMPT.to_string(),
|
||||||
io,
|
io,
|
||||||
|
@ -160,7 +161,7 @@ impl Limbo {
|
||||||
input_buff: String::new(),
|
input_buff: String::new(),
|
||||||
opts: Settings::from(opts),
|
opts: Settings::from(opts),
|
||||||
rl: None,
|
rl: None,
|
||||||
config: Some(Config::default()),
|
config: Some(config),
|
||||||
};
|
};
|
||||||
app.first_run(sql, quiet)?;
|
app.first_run(sql, quiet)?;
|
||||||
Ok(app)
|
Ok(app)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
mod palette;
|
mod palette;
|
||||||
mod terminal;
|
mod terminal;
|
||||||
|
|
||||||
|
use crate::input::OutputMode;
|
||||||
use crate::HOME_DIR;
|
use crate::HOME_DIR;
|
||||||
use nu_ansi_term::Color;
|
use nu_ansi_term::Color;
|
||||||
use palette::LimboColor;
|
use palette::LimboColor;
|
||||||
|
@ -79,6 +80,18 @@ impl Config {
|
||||||
None
|
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)]
|
#[derive(Debug, Deserialize, Clone, JsonSchema, Validate)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue