UNPKG

597 BPlain TextView Raw
1#!/usr/bin/env node
2
3var path = require('path');
4var uuid = require(path.join(__dirname, '..'));
5
6var arg = process.argv[2];
7
8if ('--help' === arg) {
9 console.log('\n USAGE: uuid [version] [options]\n\n');
10 console.log(' options:\n');
11 console.log(' --help Display this message and exit\n');
12 process.exit(0);
13}
14
15if (null == arg) {
16 console.log(uuid());
17 process.exit(0);
18}
19
20if ('v1' !== arg && 'v4' !== arg) {
21 console.error('Version must be RFC4122 version 1 or version 4, denoted as "v1" or "v4"');
22 process.exit(1);
23}
24
25console.log(uuid[arg]());
26process.exit(0);