Skip to content

Commit d629dad

Browse files
committed
bet
1 parent 559b654 commit d629dad

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

crates/cli/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub struct Args {
139139
pub no_verbose: bool,
140140

141141
/// Number of blocks per file
142-
#[arg(short, long, default_value_t = 1000, help_heading = "Output Options")]
142+
#[arg(short, long, default_value_t = 1000, help_heading = "Output Options", value_parser = clap::value_parser!(u64).ref_filter(|s| *s > 0, "chunk_size must be greater than 0"))]
143143
pub chunk_size: u64,
144144

145145
/// Number of files (alternative to --chunk-size)

crates/freeze/src/types/chunks/number_chunk.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ impl NumberChunk {
7474

7575
/// align boundaries of chunk to clean boundaries
7676
pub fn align(self, chunk_size: u64) -> Option<NumberChunk> {
77+
if chunk_size == 0 {
78+
// Cannot align with a chunk_size of 0, return None or self based on desired behavior.
79+
// Returning None seems appropriate as alignment isn't possible.
80+
return None;
81+
}
7782
match self {
7883
NumberChunk::Numbers(numbers) => Some(NumberChunk::Numbers(numbers)),
7984
NumberChunk::Range(start, end) => {

0 commit comments

Comments
 (0)