Skip to content

Commit

Permalink
test: fixes the test case for -d on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Nov 28, 2024
1 parent c8fbc10 commit b9dfec4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@

[![Build Status](https://github.com/kaelzhang/shell-safe-rm/actions/workflows/nodejs.yml/badge.svg)](https://github.com/kaelzhang/shell-safe-rm/actions/workflows/nodejs.yml)

A much safer replacement of bash `rm` with **ALMOST FULL** features of the origin `rm` command.
[Safe-rm][safe-rm], a much safer replacement of [`rm`][rm] with **ALMOST FULL** features of the origin [`rm`][rm] command.

The project was initially developed for Mac OS X, and then tested on Linux.

## Features
- Supports both MacOS and Linux with full test coverage.
- Using `safe-rm`, the files or directories you choose to remove will be moved to the system Trash instead of simply deleting them. You could put them back whenever you want manually.
- On MacOS, `safe-rm` will use [AppleScript][applescript] to delete files or directories as much as possible to enable the built-in "put-back" capability in the system Trash bin.
- On Linux, t also follows the operating system's conventions for handling duplicate files in the Trash to avoid overwriting
- On Linux, it also follows the operating system's conventions for handling duplicate files in the Trash to avoid overwriting
- Supports Custom [configurations](#configuration).

## Supported options

For those implemented options, safe-rm will act **exactly the same** as the original `rm` command
For those implemented options, safe-rm will act **exactly the same** as the original `rm` command:

| Option | Brief | Description |
| ------ | ----- | ------------ |
Expand Down Expand Up @@ -136,3 +136,5 @@ alias="SAFE_RM_CONF=/path/to/safe-rm.conf safe-rm"


[applescript]: https://en.wikipedia.org/wiki/AppleScript
[rm]: https://en.wikipedia.org/wiki/Rm_(Unix)
[safe-rm]: https://github.com/kaelzhang/shell-safe-rm
4 changes: 1 addition & 3 deletions test/cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +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"')
t.true(result1.stderr.includes('a directory'), 'stderr should include "a directory"')

const result2 = await runRm(['-d', dirpath])

Expand Down

0 comments on commit b9dfec4

Please sign in to comment.