Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ func parseFlags(args []string, stderr io.Writer) (options, error) {
return options{}, errors.New("--max-retries must be 0 or greater")
}
if opts.ChunkSize <= 0 {
opts.ChunkSize = defaultChunkSize
return options{}, errors.New("--chunk-size must be positive")
}

opts.SourceURLs = fs.Args()
Expand Down
10 changes: 10 additions & 0 deletions internal/cli/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,16 @@ func TestParseFlagsRejectsInvalidMaxRetries(t *testing.T) {
}
}

func TestParseFlagsRejectsNonPositiveChunkSize(t *testing.T) {
testCases := []string{"0", "-1"}
for _, value := range testCases {
_, err := parseFlags([]string{"--chunk-size", value, "https://example.com"}, io.Discard)
if err == nil || !strings.Contains(err.Error(), "--chunk-size must be positive") {
t.Fatalf("parseFlags error=%v, want chunk-size validation error for value=%s", err, value)
}
}
}

func TestParseFlagsAllowsVersionWithoutURL(t *testing.T) {
opts, err := parseFlags([]string{"--version"}, io.Discard)
if err != nil {
Expand Down
Loading