mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-25 09:13:39 +01:00
Merge branch 'master' into feature/included_completions
This commit is contained in:
commit
f0e30c907c
@ -83,6 +83,7 @@
|
|||||||
- Add `theme::theme` for choosing an appropriate theme based on the
|
- Add `theme::theme` for choosing an appropriate theme based on the
|
||||||
terminal's color scheme, see #2896 (@bash)
|
terminal's color scheme, see #2896 (@bash)
|
||||||
- [BREAKING] Remove `HighlightingAssets::default_theme`. Use `theme::default_theme` instead.
|
- [BREAKING] Remove `HighlightingAssets::default_theme`. Use `theme::default_theme` instead.
|
||||||
|
- Add `PrettyPrinter::print_with_writer` for custom output destinations, see #3070 (@kojix2)
|
||||||
|
|
||||||
# v0.24.0
|
# v0.24.0
|
||||||
|
|
||||||
|
2
assets/themes/Nord-sublime
vendored
2
assets/themes/Nord-sublime
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 0d655b23d6b300e691676d9b90a68d92b267f7ec
|
Subproject commit bf92a9e4457dc2f97efebc59bbeac95933ec6515
|
2
assets/themes/sublime-snazzy
vendored
2
assets/themes/sublime-snazzy
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 70343201f1d7539adbba3c79e2fe81c2559a0431
|
Subproject commit 48f43a735037195021fa69d99c1180bf12f38f78
|
@ -281,6 +281,11 @@ impl<'a> PrettyPrinter<'a> {
|
|||||||
/// If you want to call 'print' multiple times, you have to call the appropriate
|
/// If you want to call 'print' multiple times, you have to call the appropriate
|
||||||
/// input_* methods again.
|
/// input_* methods again.
|
||||||
pub fn print(&mut self) -> Result<bool> {
|
pub fn print(&mut self) -> Result<bool> {
|
||||||
|
self.print_with_writer(None::<&mut dyn std::fmt::Write>)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pretty-print all specified inputs to a specified writer.
|
||||||
|
pub fn print_with_writer<W: std::fmt::Write>(&mut self, writer: Option<W>) -> Result<bool> {
|
||||||
let highlight_lines = std::mem::take(&mut self.highlighted_lines);
|
let highlight_lines = std::mem::take(&mut self.highlighted_lines);
|
||||||
self.config.highlighted_lines = HighlightedLineRanges(LineRanges::from(highlight_lines));
|
self.config.highlighted_lines = HighlightedLineRanges(LineRanges::from(highlight_lines));
|
||||||
self.config.term_width = self
|
self.config.term_width = self
|
||||||
@ -317,9 +322,15 @@ impl<'a> PrettyPrinter<'a> {
|
|||||||
|
|
||||||
// Run the controller
|
// Run the controller
|
||||||
let controller = Controller::new(&self.config, &self.assets);
|
let controller = Controller::new(&self.config, &self.assets);
|
||||||
|
|
||||||
|
// If writer is provided, pass it to the controller, otherwise pass None
|
||||||
|
if let Some(mut w) = writer {
|
||||||
|
controller.run(inputs.into_iter().map(|i| i.into()).collect(), Some(&mut w))
|
||||||
|
} else {
|
||||||
controller.run(inputs.into_iter().map(|i| i.into()).collect(), None)
|
controller.run(inputs.into_iter().map(|i| i.into()).collect(), None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for PrettyPrinter<'_> {
|
impl Default for PrettyPrinter<'_> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
@ -164,7 +164,7 @@ impl fmt::Display for ThemeName {
|
|||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub enum DetectColorScheme {
|
pub enum DetectColorScheme {
|
||||||
/// Only query the terminal for its colors when appropriate (i.e. when the the output is not redirected).
|
/// Only query the terminal for its colors when appropriate (i.e. when the output is not redirected).
|
||||||
#[default]
|
#[default]
|
||||||
Auto,
|
Auto,
|
||||||
/// Always query the terminal for its colors.
|
/// Always query the terminal for its colors.
|
||||||
|
Loading…
Reference in New Issue
Block a user