uuid 597 B

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