💾 Archived View for gmi.noulin.net › gitRepositories › git-off › file › src › node_modules › rimraf … captured on 2023-01-29 at 13:12:31. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

git-off

Log

Files

Refs

README

bin.js (838B)

     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 }