feat(cli): --annotate --occurrence N marks the named occurrence of a quote - #93
Merged
Merged
Conversation
…quote --annotate anchored on the first occurrence of the quote, so a phrase that appears more than once could not be marked in a later place from the command line. --occurrence N (1-based, non-overlapping matches, as str::match_indices counts them) picks the match; without it the first is marked as before. A missing occurrence fails and says how many there are. add_quote_annotation_at carries the occurrence; add_quote_annotation keeps its signature for the tests that call it.
5 tasks
Merged
jgwill
added a commit
to miadisabelle/mia-plannotator-tui
that referenced
this pull request
Sep 25, 2026
The fork's only change, --annotate --occurrence N (#1), landed upstream as plannotator#93, so the two conflicts in app/mod.rs and cli.rs take upstream's side and main now matches upstream/main. Verified before pushing, against 0.6.0 from this fork: --blocks and --export output identical, author/author_name survive a rewrite of the store (jgwill/Miadi tide), and jgwill/gaia 11-plannotator-tmux-review.sh delivers and resolves a Claude transcript with the 0.9.4 build. jgwill/gaia#87
1 task
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.
--annotateanchors a mark on the first occurrence of its quote (add_quote_annotationrunssource.find(quote)). A phrase that appears more than once in a document can therefore not be marked anywhere later from the command line. The TUI can do it, because a drag selects an exact range. This PR adds--occurrence Nto--annotate.What changed
--annotate <file> <quote> <text> [kind] [--occurrence N].Nis 1-based and counts non-overlapping matches, the waystr::match_indicesdoes. Without the flag, the first occurrence is marked as today. The kind and the flag can come in either order.--occurrence 0, a missing value and a value that is not a number are refused with a message. An occurrence that does not exist fails and says how many there are.add_quote_annotation_attakes the occurrence.add_quote_annotationkeeps its signature and delegates with 1. It is now#[cfg(test)], because only tests call it, the same wayis_transientandfirst_fileare marked.README.mdandcrates/plannotator-tui/README.mdshow the flag.Validation
cargo test --workspacepasses: 288 tests, zero failures. Three are new, intests/annotate_occurrence.rs. They run the real binary with a privatePLANNOTATOR_DATA_DIR. The second occurrence of a repeated phrase is exported with its own line number, no flag still marks the first occurrence, and a missing or zero occurrence fails.cargo fmt --allis clean.cargo clippy --workspace --all-targetsreports only the two existing warnings inapp/compose.rs.🤖 Generated with Claude Code