diff --git a/README.md b/README.md index 464a06d..d88e147 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,19 @@ The project was initially developed for Mac OS X, and then tested on Linux. For those implemented options, safe-rm will act **exactly the same** as the original `rm` command -`-i`, `--interactive` +`-i`, `--interactive`: Prompts you to confirm before removing each file. -`-I`, `--interactive=once` +`-I`, `--interactive=once`: Prompts only once before removing more than three files or when recursively removing directories. -`-f`, `--force` +`-f`, `--force`: Removes files without prompting for confirmation, ignoring nonexistent files and overriding file protections -`-r`, `-R`, `--recursive`, `--Recursive` +`-r`, `-R`, `--recursive`, `--Recursive`: Removes directories and their contents recursively. Required for deleting directories. -`-v`, `--verbose` +`-v`, `--verbose`: Displays detailed information about each file or directory being removed. -`--` +`-d`, '--directory': Removes empty directories. `safe-rm` can handle empty directories specifically with this flag. + +`--`: Used to indicate the end of options. Useful if a filename starts with a `-`. Combined short options are also supported, such as diff --git a/test/cases.js b/test/cases.js index bded17e..cfecf8c 100644 --- a/test/cases.js +++ b/test/cases.js @@ -1,6 +1,7 @@ const path = require('path') const {v4: uuid} = require('uuid') const delay = require('delay') +const log = require('util').debuglog('safe-rm') const { generateContextMethods, @@ -219,6 +220,8 @@ module.exports = ( const dirpath = await createDir() const result1 = await runRm([dirpath]) + log('rm a dir without -d', result1) + t.is(result1.code, 1, 'exit code should be 1') t.true(result1.stderr.includes('is a directory'), 'stderr should include "is a directory"')