You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
440 B

4 years ago
  1. #!/usr/bin/env node
  2. var errno = require('./')
  3. , arg = process.argv[2]
  4. , data, code
  5. if (arg === undefined) {
  6. console.log(JSON.stringify(errno.code, null, 2))
  7. process.exit(0)
  8. }
  9. if ((code = +arg) == arg)
  10. data = errno.errno[code]
  11. else
  12. data = errno.code[arg] || errno.code[arg.toUpperCase()]
  13. if (data)
  14. console.log(JSON.stringify(data, null, 2))
  15. else {
  16. console.error('No such errno/code: "' + arg + '"')
  17. process.exit(1)
  18. }