説明なし

rimraf 744B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env node
  2. var rimraf = require('./')
  3. var help = false
  4. var dashdash = false
  5. var args = process.argv.slice(2).filter(function(arg) {
  6. if (dashdash)
  7. return !!arg
  8. else if (arg === '--')
  9. dashdash = true
  10. else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
  11. help = true
  12. else
  13. return !!arg
  14. });
  15. if (help || args.length === 0) {
  16. // If they didn't ask for help, then this is not a "success"
  17. var log = help ? console.log : console.error
  18. log('Usage: rimraf <path>')
  19. log('')
  20. log(' Deletes all files and folders at "path" recursively.')
  21. log('')
  22. log('Options:')
  23. log('')
  24. log(' -h, --help Display this usage info')
  25. process.exit(help ? 0 : 1)
  26. } else {
  27. args.forEach(function(arg) {
  28. rimraf.sync(arg)
  29. })
  30. }