Skip to content

Commit

Permalink
ignore rm flags
Browse files Browse the repository at this point in the history
  • Loading branch information
vdemedes committed Dec 29, 2015
1 parent 7953b51 commit 2d63fb6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const cli = meow(`
$ trash unicorn.png rainbow.png
$ trash '*.png' '!unicorn.png'
`, {
string: ['_']
string: ['_'],
// ignore all flags of `rm` program
boolean: ['r', 'f', 'i', 'd', 'P', 'R', 'v', 'W']
});

updateNotifier({pkg: cli.pkg}).notify();
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ trash --help

## Tip

Add `alias t=trash` to your `.zshrc`/`.bashrc` to reduce typing: `$ t unicorn.png`.
Add `alias rm=trash` to your `.zshrc`/`.bashrc` to reduce typing & safely trash files: `$ rm unicorn.png`.


## [FAQ](https://github.com/sindresorhus/trash#faq)
Expand Down
8 changes: 7 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ import tempWrite from 'temp-write';
import pathExists from 'path-exists';
import execa from 'execa';

test(async t => {
test('trash file', async t => {
const filename = tempWrite.sync('foo');
await execa('./cli.js', [filename]);
t.false(pathExists.sync(filename));
});

test('ignore rm flags', async t => {
const filename = tempWrite.sync('foo');
await execa('./cli.js', ['-rf', filename]);
t.false(pathExists.sync(filename));
});

0 comments on commit 2d63fb6

Please sign in to comment.