Closed eth-p closed 3 years ago
While I don't think anybody would intentionally run into it, having a warning or error just in case is something that would help improve UX.
That sounds good, yes! We could probably mark them as conflicting (via clap
), or as "overrides with".
Note: I'm doing a class assignment regarding creating tests (from scratch) for an open-source command line program, and I chose
hexyl
for it.
That is an awesome assignment! Thank you for choosing hexyl
:+1: :smile:
By the way: if someone starts implementing integration-style tests for hexyl
, I think we should consider using assert_cmd
(similar to how we use it for bat
).
A test for this would look similar to:
#[test]
fn fail_if_length_and_bytes_options_are_used_simultaneously() {
hexyl().arg("--length=10").arg("--bytes=5").assert().failure();
}
When specifying both
--length
and--bytes
in either long or short form, the value of--length
will be chosen while the value specified by--bytes
will be discarded silently. While I don't think anybody would intentionally run into it, having a warning or error just in case is something that would help improve UX.https://github.com/sharkdp/hexyl/blob/cc5b308fc9c2ca57ba176cf69a237f13428bb8e3/src/bin/hexyl.rs#L174-L176
Note: I'm doing a class assignment regarding creating tests (from scratch) for an open-source command line program, and I chose
hexyl
for it. You might have a couple more of these on the way, depending on what the assignment brings to light :)