feat(update): add -c/--collection filter to qmd update#566
Open
feat(update): add -c/--collection filter to qmd update#566
Conversation
1. Completion message — instead of always printing ✓ All collections updated., it now prints the collection name when exactly one was updated (e.g. ✓ 'mynotes' updated.), and falls back to ✓ N collections updated. for multiple. 2. Type normalization — cli.opts.collection is typed as string | string[] | undefined (because multiple: true in parseArgs doesn't guarantee an array when called with a single value). The ternary normalizes it to string[] | undefined before passing to updateCollections. 3. Database interface fix — transaction was called on a Database instance in store.ts but was absent from the interface definition, causing a TypeScript build error. Added the correct generic signature transaction<T>(fn: () => T): () => T.
2 tasks
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.
fix(update): add -c/--collection filter to
qmd updateSummary
qmd updatenow accepts-c <name>(or--collection <name>) to re-index a single collection instead of all collections-cflags are supported (e.g.qmd update -c notes -c work)✓ 'notes' updated.vs✓ 3 collections updated.)transactionto theDatabaseinterface insrc/db.ts, which was used instore.tsbut missing from the type definition (caused a build failure under updatedbetter-sqlite3type declarations)Behaviour
Files changed
src/cli/qmd.ts—updateCollections()accepts optionalcollectionFilter?: string[]; filters and validates before iterating; updated completion messagesrc/db.ts— addedtransaction<T>to theDatabaseinterface