diff --git a/src/bin/hexyl.rs b/src/bin/hexyl.rs index 1417c17..367cc4e 100644 --- a/src/bin/hexyl.rs +++ b/src/bin/hexyl.rs @@ -61,6 +61,7 @@ fn run() -> Result<(), AnyhowError> { .short("l") .takes_value(true) .value_name("N") + .conflicts_with_all(&["length", "bytes"]) .hidden(true) .help("Yet another alias for -n/--length"), ) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 0508e53..bc718ad 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -85,6 +85,30 @@ mod length { .assert() .failure(); } + + #[test] + fn fail_if_length_and_count_options_are_used_simultaneously() { + hexyl() + .arg("hello_world_elf64") + .arg("--length=32") + .arg("-l=10") + .assert() + .failure(); + } +} + +mod bytes { + use super::hexyl; + + #[test] + fn fail_if_bytes_and_count_options_are_used_simultaneously() { + hexyl() + .arg("hello_world_elf64") + .arg("--bytes=32") + .arg("-l=10") + .assert() + .failure(); + } } mod skip {