Created
September 15, 2019 19:10
-
-
Save ggirou/ce19552721f95316d6ff097e35fecfb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const fs = require('fs'); | |
const readline = require('readline'); | |
const commitFile = process.argv[2]; | |
const fromIDE = !process.stdout.isTTY; | |
if (fromIDE) { | |
process.exit(0); | |
} | |
const input = fs.createReadStream('/dev/tty'); | |
const rl = readline.createInterface({ | |
input: input, | |
output: process.stdout | |
}); | |
rl.question('What do you think of Node.js? ', function (answer) { | |
rl.close(); | |
input.close(); | |
var message = fs.readFileSync(commitFile); | |
message = answer + "\n" + message; | |
fs.writeFileSync(commitFile, message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment