mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Add -e alias for --endianness=little
This commit is contained in:
1 parent
cba717b783
commit
9be018fbb9
1 file changed
+18
-4
+18
-4
@@ -190,9 +190,18 @@ fn run() -> Result<()> {
|
|||||||
.help(
|
.help(
|
||||||
"Whether to print out groups in little-endian or big-endian \
|
"Whether to print out groups in little-endian or big-endian \
|
||||||
format. This option only has an effect if the '--group-size' \
|
format. This option only has an effect if the '--group-size' \
|
||||||
is larger than 1.",
|
is larger than 1. '-e' can be used as an alias for \
|
||||||
|
'--endianness=little'.",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("little_endian_format")
|
||||||
|
.short('e')
|
||||||
|
.action(ArgAction::SetTrue)
|
||||||
|
.overrides_with("endianness")
|
||||||
|
.hide(true)
|
||||||
|
.help("An alias for '--endianness=little'."),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("base")
|
Arg::new("base")
|
||||||
.short('b')
|
.short('b')
|
||||||
@@ -440,9 +449,14 @@ fn run() -> Result<()> {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
let endianness = match matches.get_one::<String>("endianness").map(String::as_ref) {
|
let little_endian_format = *matches.get_one::<bool>("little_endian_format").unwrap();
|
||||||
Some("little") => Endianness::Little,
|
let endianness = matches.get_one::<String>("endianness");
|
||||||
Some("big") => Endianness::Big,
|
let endianness = match (
|
||||||
|
endianness.map(|s| s.as_ref()).unwrap(),
|
||||||
|
little_endian_format,
|
||||||
|
) {
|
||||||
|
(_, true) | ("little", _) => Endianness::Little,
|
||||||
|
("big", _) => Endianness::Big,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
let stdout = io::stdout();
|
let stdout = io::stdout();
|
||||||
|
|||||||
Reference in new issue
Block a user