get_password.js 414 B

123456789101112131415161718192021
  1. #!/usr/bin/env node
  2. const passwords = require('../server/passwords');
  3. const key = process.argv[2];
  4. const password = passwords[key];
  5. if (password) {
  6. process.stdout.write(passwords[key]);
  7. if (process.stdout.isTTY) {
  8. process.stdout.write('\n');
  9. }
  10. }
  11. else {
  12. process.stderr.write(`Cannot find password for ${key}`);
  13. if (process.stderr.isTTY) {
  14. process.stderr.write('\n');
  15. }
  16. }