Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CICD

env:
MIN_SUPPORTED_RUST_VERSION: "1.46.0"
MIN_SUPPORTED_RUST_VERSION: "1.50.0"
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"

on:
Expand Down
11 changes: 10 additions & 1 deletion examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@ fn main() {
let mut handle = stdout.lock();

let show_color = true;
let show_char_panel = true;
let show_position_panel = true;
let use_squeezing = false;
let border_style = BorderStyle::Unicode;

let mut printer = Printer::new(&mut handle, show_color, border_style, use_squeezing);
let mut printer = Printer::new(
&mut handle,
show_color,
show_char_panel,
show_position_panel,
border_style,
use_squeezing,
);
printer.print_all(&input[..]).unwrap();
}
30 changes: 29 additions & 1 deletion src/bin/hexyl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,41 @@ fn run() -> Result<(), AnyhowError> {
.takes_value(true)
.value_name("WHEN")
.possible_values(&["always", "auto", "never"])
.default_value_if("plain", None, "never")
.default_value("always")
.help(
"When to use colors. The auto-mode only displays colors if the output \
goes to an interactive terminal",
),
)
.arg(Arg::with_name("plain").short("p").long("plain").help(
"Display output with --no-characters, --no-position, --border=none, and --color=never.",
))
.arg(
Arg::with_name("border")
.long("border")
.takes_value(true)
.value_name("STYLE")
.possible_values(&["unicode", "ascii", "none"])
.default_value_if("plain", None, "none")
Comment thread
sharkdp marked this conversation as resolved.
.default_value("unicode")
.help(
"Whether to draw a border with Unicode characters, ASCII characters, \
or none at all",
),
)
.arg(
Arg::with_name("no_chars")
.short("C")
.long("no-characters")
.help("Whether to display the character panel on the right."),
)
.arg(
Arg::with_name("no_position")
Comment thread
mkatychev marked this conversation as resolved.
.short("P")
.long("no-position")
.help("Whether to display the position panel on the left."),
)
.arg(
Arg::with_name("display_offset")
.short("o")
Expand Down Expand Up @@ -237,6 +254,10 @@ fn run() -> Result<(), AnyhowError> {

let squeeze = !matches.is_present("nosqueezing");

let show_char_panel = !matches.is_present("no_chars") && !matches.is_present("plain");

let show_position_panel = !matches.is_present("no_position") && !matches.is_present("plain");

let display_offset: u64 = matches
.value_of("display_offset")
.map(|s| {
Expand All @@ -251,7 +272,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, border_style, squeeze);
let mut printer = Printer::new(
&mut stdout_lock,
show_color,
show_char_panel,
show_position_panel,
border_style,
squeeze,
);
printer.display_offset(skip_offset + display_offset);
printer.print_all(&mut reader).map_err(|e| anyhow!(e))?;

Expand Down
Loading