Conversation
…last` `jp conversation compact` previously rejected `--keep-first`/`--keep-last` whenever `--first`/`--last` were also given. Users who wanted to compact a bounded window while still preserving a prefix or suffix inside that window had no way to express it. `--keep-first N --first M` now compacts the first M turns minus the preserved prefix, e.g. `--keep-first 1 --first 16` compacts turns 2 through 16. Likewise `--keep-last N --last M` compacts the last M turns minus the preserved suffix, e.g. `--keep-last 2 --last 16` compacts the 14 turns before the final 2. Since clap's `conflicts_with` can't express "reject only when the kept count exceeds the selected count," a `Compact::validate` step runs before compaction and rejects `--keep-first`/`--keep-last` values larger than the corresponding `--first`/`--last` count, returning an error instead of silently compacting nothing. Equal values are still allowed, since that legitimately selects an empty range. Signed-off-by: Jean Mertz <git@jeanmertz.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
jp conversation compactpreviously rejected--keep-first/--keep-lastwhenever--first/--lastwere also given. Users who wanted to compact a bounded window while still preserving a prefix or suffix inside that window had no way to express it.--keep-first N --first Mnow compacts the first M turns minus the preserved prefix, e.g.--keep-first 1 --first 16compacts turns 2 through 16. Likewise--keep-last N --last Mcompacts the last M turns minus the preserved suffix, e.g.--keep-last 2 --last 16compacts the 14 turns before the final 2.Since clap's
conflicts_withcan't express "reject only when the kept count exceeds the selected count," aCompact::validatestep runs before compaction and rejects--keep-first/--keep-lastvalues larger than the corresponding--first/--lastcount, returning an error instead of silently compacting nothing. Equal values are still allowed, since that legitimately selects an empty range.