"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/rimraf/bin.js" (8 Mar 2017, 1196 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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> [<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   go(0)
   31 
   32 function go (n) {
   33   if (n >= args.length)
   34     return
   35   rimraf(args[n], function (er) {
   36     if (er)
   37       throw er
   38     go(n+1)
   39   })
   40 }