summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/worker-farm/node_modules/errno/cli.js
blob: f841771b8aff152023111582eef54e415f4d8e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env node

var errno = require('./')
  , arg   = process.argv[2]
  , data, code

if (arg === undefined)
  return console.log(JSON.stringify(errno.code, null, 2))

if ((code = +arg) == arg)
  data = errno.errno[code]
else
  data = errno.code[arg] || errno.code[arg.toUpperCase()]

if (data)
  console.log(JSON.stringify(data, null, 2))
else {
  console.error('No such errno/code: "' + arg + '"')
  process.exit(1)
}