Skip to content

fix: readable error for non-numeric --max-count and --offset-width - #9

Merged
capjan merged 1 commit into
mainfrom
fix/readable-integer-option-errors
Sep 25, 2026
Merged

capjan merged 1 commit into
mainfrom
fix/readable-integer-option-errors

Conversation

@capjan

@capjan capjan commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Summary

Since 2.0.0 an invalid --max-count value is an error (see #1), but the message named the internal type:

Cannot parse argument 'abc' for option '--max-count' as expected type 'System.Nullable`1[System.Int32]'.

Both integer options (--max-count, --offset-width) now use a shared custom parser:

Option '--max-count' requires a whole number, but got 'abc'.

Exit code stays 1, the message goes to stderr. The --offset-width default (6) is now documented in its help text instead of the generated [default: 6].

This does not close #1 on purpose, that is up to the release of 2.0.0.

Test plan

  • dotnet test: 32/32 (new: non-numeric --max-count, -m, --offset-width, offset column width)
  • Manual run with abc for both options
  • CI green on ubuntu, windows and macos

The error named the internal type System.Nullable`1[System.Int32].
Use a custom parser that reports 'Option ... requires a whole number'.
Related to #1.
@capjan
capjan merged commit 0a171b4 into main Sep 25, 2026
3 checks passed
@capjan
capjan deleted the fix/readable-integer-option-errors branch September 25, 2026 19:46
@capjan capjan mentioned this pull request Sep 25, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing error handling for max-count argument

1 participant