diff --git a/src/cli/qmd.ts b/src/cli/qmd.ts index 22b5561c..66db2606 100755 --- a/src/cli/qmd.ts +++ b/src/cli/qmd.ts @@ -494,7 +494,7 @@ async function showStatus(): Promise { closeDb(); } -async function updateCollections(): Promise { +async function updateCollections(collectionFilter?: string[]): Promise { const db = getDb(); const storeInstance = getStore(); // Collections are defined in YAML; no duplicate cleanup needed. @@ -502,7 +502,17 @@ async function updateCollections(): Promise { // Clear Ollama cache on update clearCache(db); - const collections = listCollections(db); + let collections = listCollections(db); + + // Filter by collection names if specified + if (collectionFilter && collectionFilter.length > 0) { + collections = collections.filter(c => collectionFilter.includes(c.name)); + if (collections.length === 0) { + console.log(`${c.dim}No matching collections found. Available: ${listCollections(db).map(c => c.name).join(', ')}${c.reset}`); + closeDb(); + return; + } + } if (collections.length === 0) { console.log(`${c.dim}No collections found. Run 'qmd collection add .' to index markdown files.${c.reset}`); @@ -2950,7 +2960,7 @@ if (isMain) { break; case "update": - await updateCollections(); + await updateCollections(cli.opts.collection); break; case "embed":