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