Projekt

Obecné

Profil

Stáhnout (440 Bajtů) Statistiky
| Větev: | Revize:
1
#!/usr/bin/env node
2

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

    
7
if (arg === undefined) {
8
  console.log(JSON.stringify(errno.code, null, 2))
9
  process.exit(0)
10
}
11

    
12
if ((code = +arg) == arg)
13
  data = errno.errno[code]
14
else
15
  data = errno.code[arg] || errno.code[arg.toUpperCase()]
16

    
17
if (data)
18
  console.log(JSON.stringify(data, null, 2))
19
else {
20
  console.error('No such errno/code: "' + arg + '"')
21
  process.exit(1)
22
}
(5-5/9)