Skip to content

Commit

Permalink
README.md: adds descriptions for options
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Nov 28, 2024
1 parent 9113015 commit 7517662
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions test/cases.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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"')

Expand Down

0 comments on commit 7517662

Please sign in to comment.