1 | #!/usr/bin/env node
|
2 |
|
3 | var path = require('path');
|
4 | var uuid = require(path.join(__dirname, '..'));
|
5 |
|
6 | var arg = process.argv[2];
|
7 |
|
8 | if ('--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 |
|
15 | if (null == arg) {
|
16 | console.log(uuid());
|
17 | process.exit(0);
|
18 | }
|
19 |
|
20 | if ('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 |
|
25 | console.log(uuid[arg]());
|
26 | process.exit(0);
|