31 lines
784 B
JavaScript
31 lines
784 B
JavaScript
const { processAndOrganizeNotes } = require('./src/noteOrganizer');
|
|
const { writeOrganizedNotes } = require('./src/outputWriter');
|
|
|
|
async function main() {
|
|
try {
|
|
const args = process.argv.slice(2);
|
|
if (args.length < 1 || args.length > 2) {
|
|
console.log('Usage: node index.js <directory_path> [file_pattern]');
|
|
return;
|
|
}
|
|
|
|
const [dirPath, pattern] = args;
|
|
|
|
console.log(`Starting to process notes in: ${dirPath}`);
|
|
if (pattern) {
|
|
console.log(`Filtering by pattern: ${pattern}`);
|
|
}
|
|
|
|
const organizedNotes = await processAndOrganizeNotes(dirPath, pattern);
|
|
|
|
if (organizedNotes) {
|
|
writeOrganizedNotes(__dirname, organizedNotes);
|
|
}
|
|
} catch (error) {
|
|
console.error('An unexpected error occurred:', error);
|
|
}
|
|
}
|
|
|
|
main();
|
|
|