diff --git a/cmd.js b/cmd.js new file mode 100755 index 0000000..ed84bfd --- /dev/null +++ b/cmd.js @@ -0,0 +1,13 @@ +#!/usr/bin/env node + +var sanitize = require('./') +var replacement = process.argv[2] +var data = [] +var sanitizeAndOutput = () => { + var str = Buffer.concat(data).toString() + var sanitized = sanitize(str, { replacement }) + process.stdout.write(sanitized) +} + +process.stdin.on('data', chunk => data.push(chunk)) +process.stdin.on('end', sanitizeAndOutput) \ No newline at end of file diff --git a/package.json b/package.json index 13ca38d..b9059d2 100644 --- a/package.json +++ b/package.json @@ -31,5 +31,6 @@ "mktemp": "^0.4.0", "tape": "^4.2.2", "zuul": "^3.7.2" - } + }, + "bin": "cmd.js" }