c-blake / cligen

Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs at
https://c-blake.github.io/cligen/
ISC License
507 stars 24 forks source link

add `nextSlice` helper to advance slice to sep and store in a given mutable slice #214

Closed Vindaar closed 2 years ago

Vindaar commented 2 years ago

This is similar to the readLine procedure for the Stream type in the stdlib, except working on slices.

The implementation is obviously directly based on the mSlices iterator. Initially I wanted to base one on the other, but I decided against it for now. This way I can add a nil check in nextSlice and don't need to shadow the input mslc argument in mSlices to have a slice that we advance for each yielded slice.

c-blake commented 2 years ago

Looks good to me. Feel free to re-PR if you discover any issues.