cli.js 422 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env node
  2. 'use strict';
  3. var pkg = require('./package.json');
  4. var userHome = require('./');
  5. function help() {
  6. console.log([
  7. pkg.description,
  8. '',
  9. 'Example',
  10. ' $ user-home',
  11. ' /Users/sindresorhus'
  12. ].join('\n'));
  13. }
  14. if (process.argv.indexOf('--help') !== -1) {
  15. help();
  16. return;
  17. }
  18. if (process.argv.indexOf('--version') !== -1) {
  19. console.log(pkg.version);
  20. return;
  21. }
  22. process.stdout.write(userHome);