mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Implement builder pattern
This commit is contained in:
1 parent
9bc81820e7
commit
80163764c3
3 files changed
+92
-22
No files matched your search
+9
-10
@@ -18,7 +18,7 @@ use thiserror::Error as ThisError;
|
||||
|
||||
use terminal_size::terminal_size;
|
||||
|
||||
use hexyl::{BorderStyle, Input, Printer};
|
||||
use hexyl::{BorderStyle, Input, PrinterBuilder};
|
||||
|
||||
const DEFAULT_BLOCK_SIZE: i64 = 512;
|
||||
|
||||
@@ -335,15 +335,14 @@ fn run() -> Result<(), AnyhowError> {
|
||||
let stdout = io::stdout();
|
||||
let mut stdout_lock = stdout.lock();
|
||||
|
||||
let mut printer = Printer::new(
|
||||
&mut stdout_lock,
|
||||
show_color,
|
||||
show_char_panel,
|
||||
show_position_panel,
|
||||
border_style,
|
||||
squeeze,
|
||||
panels,
|
||||
);
|
||||
let mut printer = PrinterBuilder::new(&mut stdout_lock)
|
||||
.show_color(show_color)
|
||||
.show_char_panel(show_char_panel)
|
||||
.show_position_panel(show_position_panel)
|
||||
.with_border_style(border_style)
|
||||
.with_squeeze(squeeze)
|
||||
.with_panels(panels)
|
||||
.build();
|
||||
printer.display_offset(skip_offset + display_offset);
|
||||
printer.print_all(&mut reader).map_err(|e| anyhow!(e))?;
|
||||
|
||||
|
||||
Reference in new issue
Block a user