#!/usr/bin/node const fs = require('fs'); var DIR = process.argv[2]; var TITLE = process.argv[3] || "Gallery"; if(!DIR || !TITLE) { console.log(`### ERROR! No directory and/or title provided!`); console.log(`Usage: node gallery.js {directory} {title}`); process.exit(1); } outHtml = ` ${TITLE}
тод  

${TITLE}



Finder:
` var files = fs.readdirSync(DIR); for(let f of files) { if(!f.endsWith(".svg")) continue; outHtml += `
${f}
\n` } outHtml += `
` console.log(`### Generating gallery index.html for ${DIR}`); fs.writeFileSync(DIR + '/index.html', outHtml);