mirror of
https://github.com/sharkdp/bat.git
synced 2025-03-14 06:38:24 +00:00
Fix signatures
This commit is contained in:
parent
103a2f0d9b
commit
d929becefc
@ -206,7 +206,7 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result<
|
|||||||
)?;
|
)?;
|
||||||
config.theme = theme.to_string();
|
config.theme = theme.to_string();
|
||||||
Controller::new(&config, &assets)
|
Controller::new(&config, &assets)
|
||||||
.run(vec![theme_preview_file()])
|
.run(vec![theme_preview_file()], None)
|
||||||
.ok();
|
.ok();
|
||||||
writeln!(stdout)?;
|
writeln!(stdout)?;
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result<
|
|||||||
fn run_controller(inputs: Vec<Input>, config: &Config, cache_dir: &Path) -> Result<bool> {
|
fn run_controller(inputs: Vec<Input>, config: &Config, cache_dir: &Path) -> Result<bool> {
|
||||||
let assets = assets_from_cache_or_binary(config.use_custom_assets, cache_dir)?;
|
let assets = assets_from_cache_or_binary(config.use_custom_assets, cache_dir)?;
|
||||||
let controller = Controller::new(config, &assets);
|
let controller = Controller::new(config, &assets);
|
||||||
controller.run(inputs)
|
controller.run(inputs, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "bugreport")]
|
#[cfg(feature = "bugreport")]
|
||||||
|
@ -80,7 +80,7 @@ impl<'b> Controller<'b> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//let writer = output_type.handle()?;
|
//let writer = output_type.handle()?;
|
||||||
let writer = output_buffer.map_or_else(
|
let mut writer = output_buffer.map_or_else(
|
||||||
|| OutputHandle::IoWrite(output_type.handle().unwrap()),
|
|| OutputHandle::IoWrite(output_type.handle().unwrap()),
|
||||||
|buf| OutputHandle::FmtWrite(buf),
|
|buf| OutputHandle::FmtWrite(buf),
|
||||||
);
|
);
|
||||||
@ -91,15 +91,15 @@ impl<'b> Controller<'b> {
|
|||||||
let identifier = stdout_identifier.as_ref();
|
let identifier = stdout_identifier.as_ref();
|
||||||
let is_first = index == 0;
|
let is_first = index == 0;
|
||||||
let result = if input.is_stdin() {
|
let result = if input.is_stdin() {
|
||||||
self.print_input(input, writer, io::stdin().lock(), identifier, is_first)
|
self.print_input(input, &mut writer, io::stdin().lock(), identifier, is_first)
|
||||||
} else {
|
} else {
|
||||||
// Use dummy stdin since stdin is actually not used (#1902)
|
// Use dummy stdin since stdin is actually not used (#1902)
|
||||||
self.print_input(input, writer, io::empty(), identifier, is_first)
|
self.print_input(input, &mut writer, io::empty(), identifier, is_first)
|
||||||
};
|
};
|
||||||
if let Err(error) = result {
|
if let Err(error) = result {
|
||||||
match writer {
|
match writer {
|
||||||
OutputHandle::FmtWrite(writer) => todo!(),
|
OutputHandle::FmtWrite(writer) => todo!(),
|
||||||
OutputHandle::IoWrite(writer) => {
|
OutputHandle::IoWrite(ref mut writer) => {
|
||||||
if attached_to_pager {
|
if attached_to_pager {
|
||||||
handle_error(&error, writer);
|
handle_error(&error, writer);
|
||||||
} else {
|
} else {
|
||||||
@ -117,7 +117,7 @@ impl<'b> Controller<'b> {
|
|||||||
fn print_input<R: BufRead>(
|
fn print_input<R: BufRead>(
|
||||||
&self,
|
&self,
|
||||||
input: Input,
|
input: Input,
|
||||||
writer: OutputHandle,
|
writer: &mut OutputHandle,
|
||||||
stdin: R,
|
stdin: R,
|
||||||
stdout_identifier: Option<&Identifier>,
|
stdout_identifier: Option<&Identifier>,
|
||||||
is_first: bool,
|
is_first: bool,
|
||||||
@ -178,7 +178,7 @@ impl<'b> Controller<'b> {
|
|||||||
fn print_file(
|
fn print_file(
|
||||||
&self,
|
&self,
|
||||||
printer: &mut dyn Printer,
|
printer: &mut dyn Printer,
|
||||||
writer: OutputHandle,
|
writer: &mut OutputHandle,
|
||||||
input: &mut OpenedInput,
|
input: &mut OpenedInput,
|
||||||
add_header_padding: bool,
|
add_header_padding: bool,
|
||||||
#[cfg(feature = "git")] line_changes: &Option<LineChanges>,
|
#[cfg(feature = "git")] line_changes: &Option<LineChanges>,
|
||||||
@ -216,7 +216,7 @@ impl<'b> Controller<'b> {
|
|||||||
fn print_file_ranges(
|
fn print_file_ranges(
|
||||||
&self,
|
&self,
|
||||||
printer: &mut dyn Printer,
|
printer: &mut dyn Printer,
|
||||||
writer: OutputHandle,
|
writer: &mut OutputHandle,
|
||||||
reader: &mut InputReader,
|
reader: &mut InputReader,
|
||||||
line_ranges: &LineRanges,
|
line_ranges: &LineRanges,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
@ -71,18 +71,18 @@ macro_rules! writeln_handle {
|
|||||||
pub(crate) trait Printer {
|
pub(crate) trait Printer {
|
||||||
fn print_header(
|
fn print_header(
|
||||||
&mut self,
|
&mut self,
|
||||||
handle: OutputHandle,
|
handle: &mut OutputHandle,
|
||||||
input: &OpenedInput,
|
input: &OpenedInput,
|
||||||
add_header_padding: bool,
|
add_header_padding: bool,
|
||||||
) -> Result<()>;
|
) -> Result<()>;
|
||||||
fn print_footer(&mut self, handle: OutputHandle, input: &OpenedInput) -> Result<()>;
|
fn print_footer(&mut self, handle: &mut OutputHandle, input: &OpenedInput) -> Result<()>;
|
||||||
|
|
||||||
fn print_snip(&mut self, handle: OutputHandle) -> Result<()>;
|
fn print_snip(&mut self, handle: &mut OutputHandle) -> Result<()>;
|
||||||
|
|
||||||
fn print_line(
|
fn print_line(
|
||||||
&mut self,
|
&mut self,
|
||||||
out_of_range: bool,
|
out_of_range: bool,
|
||||||
handle: OutputHandle,
|
handle: &mut OutputHandle,
|
||||||
line_number: usize,
|
line_number: usize,
|
||||||
line_buffer: &[u8],
|
line_buffer: &[u8],
|
||||||
) -> Result<()>;
|
) -> Result<()>;
|
||||||
@ -101,25 +101,25 @@ impl<'a> SimplePrinter<'a> {
|
|||||||
impl<'a> Printer for SimplePrinter<'a> {
|
impl<'a> Printer for SimplePrinter<'a> {
|
||||||
fn print_header(
|
fn print_header(
|
||||||
&mut self,
|
&mut self,
|
||||||
_handle: OutputHandle,
|
_handle: &mut OutputHandle,
|
||||||
_input: &OpenedInput,
|
_input: &OpenedInput,
|
||||||
_add_header_padding: bool,
|
_add_header_padding: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_footer(&mut self, _handle: OutputHandle, _input: &OpenedInput) -> Result<()> {
|
fn print_footer(&mut self, _handle: &mut OutputHandle, _input: &OpenedInput) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_snip(&mut self, _handle: OutputHandle) -> Result<()> {
|
fn print_snip(&mut self, _handle: &mut OutputHandle) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_line(
|
fn print_line(
|
||||||
&mut self,
|
&mut self,
|
||||||
out_of_range: bool,
|
out_of_range: bool,
|
||||||
handle: OutputHandle,
|
handle: &mut OutputHandle,
|
||||||
_line_number: usize,
|
_line_number: usize,
|
||||||
line_buffer: &[u8],
|
line_buffer: &[u8],
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
@ -253,7 +253,11 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_horizontal_line_term(&mut self, handle: OutputHandle, style: Style) -> Result<()> {
|
fn print_horizontal_line_term(
|
||||||
|
&mut self,
|
||||||
|
handle: &mut OutputHandle,
|
||||||
|
style: Style,
|
||||||
|
) -> Result<()> {
|
||||||
writeln_handle!(
|
writeln_handle!(
|
||||||
handle,
|
handle,
|
||||||
"{}",
|
"{}",
|
||||||
@ -262,7 +266,7 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_horizontal_line(&mut self, handle: OutputHandle, grid_char: char) -> Result<()> {
|
fn print_horizontal_line(&mut self, handle: &mut OutputHandle, grid_char: char) -> Result<()> {
|
||||||
if self.panel_width == 0 {
|
if self.panel_width == 0 {
|
||||||
self.print_horizontal_line_term(handle, self.colors.grid)?;
|
self.print_horizontal_line_term(handle, self.colors.grid)?;
|
||||||
} else {
|
} else {
|
||||||
@ -292,7 +296,7 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_header_component_indent(&mut self, handle: OutputHandle) -> Result<()> {
|
fn print_header_component_indent(&mut self, handle: &mut OutputHandle) -> Result<()> {
|
||||||
if self.config.style_components.grid() {
|
if self.config.style_components.grid() {
|
||||||
write_handle!(
|
write_handle!(
|
||||||
handle,
|
handle,
|
||||||
@ -320,7 +324,7 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
impl<'a> Printer for InteractivePrinter<'a> {
|
impl<'a> Printer for InteractivePrinter<'a> {
|
||||||
fn print_header(
|
fn print_header(
|
||||||
&mut self,
|
&mut self,
|
||||||
handle: OutputHandle,
|
handle: &mut OutputHandle,
|
||||||
input: &OpenedInput,
|
input: &OpenedInput,
|
||||||
add_header_padding: bool,
|
add_header_padding: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
@ -419,7 +423,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_footer(&mut self, handle: OutputHandle, _input: &OpenedInput) -> Result<()> {
|
fn print_footer(&mut self, handle: &mut OutputHandle, _input: &OpenedInput) -> Result<()> {
|
||||||
if self.config.style_components.grid()
|
if self.config.style_components.grid()
|
||||||
&& (self.content_type.map_or(false, |c| c.is_text()) || self.config.show_nonprintable)
|
&& (self.content_type.map_or(false, |c| c.is_text()) || self.config.show_nonprintable)
|
||||||
{
|
{
|
||||||
@ -429,7 +433,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_snip(&mut self, handle: OutputHandle) -> Result<()> {
|
fn print_snip(&mut self, handle: &mut OutputHandle) -> Result<()> {
|
||||||
let panel = self.create_fake_panel(" ...");
|
let panel = self.create_fake_panel(" ...");
|
||||||
let panel_count = panel.chars().count();
|
let panel_count = panel.chars().count();
|
||||||
|
|
||||||
@ -456,7 +460,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
fn print_line(
|
fn print_line(
|
||||||
&mut self,
|
&mut self,
|
||||||
out_of_range: bool,
|
out_of_range: bool,
|
||||||
handle: OutputHandle,
|
handle: &mut OutputHandle,
|
||||||
line_number: usize,
|
line_number: usize,
|
||||||
line_buffer: &[u8],
|
line_buffer: &[u8],
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user