Skip to content

Commit

Permalink
remove output while it's not used
Browse files Browse the repository at this point in the history
  • Loading branch information
denofevil committed Apr 9, 2017
1 parent 2bcce9b commit 6d169d1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const fs = require('fs');

function printUsageAndExit() {
console.error("Usage: <input_snippet> <output_directory>");
console.error("input_snippet can be either a file or a directory");
console.error("Usage: <input_dir>");
console.error("input_dir should be a directory with snippets json files");
process.exit(1)
}

Expand Down Expand Up @@ -59,7 +59,7 @@ function convertSnippet(snippet, context) {
templateText += "";
return templateText;
}
function convertFile(input, file, output) {
function convertFile(input, file) {
console.log(`converting ${file}`);
const snippets = JSON.parse(fs.readFileSync(`${input}/${file}`));
let templateSetText = `<templateSet group="${input}">`;
Expand All @@ -73,14 +73,13 @@ function convertFile(input, file, output) {
}

const input = process.argv[2];
const output = process.argv[3];

if (!input || !output) {
if (!input) {
printUsageAndExit()
}

fs.readdir(input, (err, files) => {
files.forEach(file => {
convertFile(input, file, output)
convertFile(input, file)
});
});

0 comments on commit 6d169d1

Please sign in to comment.