feat(cli): parse arguments with clap
The binary now derives command-line parsing from clap instead of maintaining a custom parser. SEARCH_LIMIT remains an optional positional argument and keeps its default of 1_000_000_000, while clap now owns usage errors, --help, and --version output. The parser stores the limit as NonZeroU64 so zero is rejected before the search starts. The existing CLI parsing tests now exercise clap directly, and the README documents the generated help/version flags plus the top-level program structure. Test Plan: - cargo clippy - cargo clippy --benches - cargo clippy --tests - cargo test - cargo run -- --help Trailer: Refs: local request to replace custom argument parsing with clap Dependencies: none
This commit is contained in:
@@ -3,10 +3,23 @@
|
||||
Find highly composite numbers up to a search limit.
|
||||
|
||||
```bash
|
||||
cargo run --release -- 1000000000
|
||||
cargo run --release -- [SEARCH_LIMIT]
|
||||
```
|
||||
|
||||
If no limit is given, the default is `1_000_000_000`.
|
||||
Use `--help` to see the generated command-line help and `--version` to print
|
||||
the package version.
|
||||
|
||||
## Structure
|
||||
|
||||
- `src/main.rs`
|
||||
- Command-line interface: parses the optional `SEARCH_LIMIT` argument with
|
||||
`clap` and rejects non-positive limits before the search starts.
|
||||
- Search setup: defines the default limit and the fixed prime list used for
|
||||
candidate generation.
|
||||
- Candidate generation: recursively builds only exponent sequences that can
|
||||
produce highly composite record candidates.
|
||||
- Record filtering: sorts candidates and prints each new divisor-count record.
|
||||
|
||||
## Algorithm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user