mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
Deny 'block' as unit for --block-size
This commit is contained in:
1 parent
1b1fc4b053
commit
825100c6d6
1 file changed
+5
@@ -148,6 +148,11 @@ fn run() -> Result<(), AnyhowError> {
|
||||
.value_of("block_size")
|
||||
.map(|bs| {
|
||||
let (num, unit) = extract_num_and_unit_from(bs)?;
|
||||
if let Unit::Block { custom_size: _ } = unit {
|
||||
return Err(anyhow!(
|
||||
"can not use 'block(s)' as a unit to specify block size"
|
||||
));
|
||||
};
|
||||
num.checked_mul(unit.get_multiplier())
|
||||
.ok_or_else(|| anyhow!(ByteOffsetParseError::UnitMultiplicationOverflow))
|
||||
.and_then(|x| {
|
||||
|
||||
Reference in new issue
Block a user