Comparing version
41
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
var updateNotifier = require('update-notifier'); | ||
var argv = require('minimist')(process.argv.slice(2), {string: ['_']}); | ||
var pkg = require('./package.json'); | ||
var meow = require('meow'); | ||
var trash = require('./'); | ||
var input = argv._; | ||
function help() { | ||
console.log([ | ||
var cli = meow({ | ||
help: [ | ||
'Usage', | ||
' trash <path> [<path> ...]', | ||
'', | ||
' ' + pkg.description, | ||
'', | ||
' Usage', | ||
' trash <path> [<path> ...]', | ||
'', | ||
' Example', | ||
' trash unicorn.png rainbow.png' | ||
].join('\n')); | ||
} | ||
'Example', | ||
' trash unicorn.png rainbow.png' | ||
].join('\n') | ||
}, { | ||
string: ['_'] | ||
}); | ||
updateNotifier({ | ||
packageName: pkg.name, | ||
packageVersion: pkg.version | ||
packageName: cli.pkg.name, | ||
packageVersion: cli.pkg.version | ||
}).notify(); | ||
if (argv.version) { | ||
console.log(pkg.version); | ||
return; | ||
} | ||
if (input.length === 0 || argv.help) { | ||
help(); | ||
return; | ||
} | ||
trash(input, function (err) { | ||
trash(cli.input, function (err) { | ||
if (err) { | ||
@@ -39,0 +26,0 @@ console.error(err.message); |
16
index.js
@@ -6,2 +6,3 @@ 'use strict'; | ||
var runApplescript = require('run-applescript'); | ||
var xdgTrash = require('xdg-trash'); | ||
@@ -28,15 +29,2 @@ function osx(paths, cb) { | ||
function linux(paths, cb) { | ||
execFile('./trash-put', paths, { | ||
cwd: path.join(__dirname, 'vendor') | ||
}, function (err) { | ||
if (err && /cannot trash non existent/.test(err.message)) { | ||
cb(new Error('Item doesn\'t exist')); | ||
return; | ||
} | ||
cb(err); | ||
}); | ||
} | ||
function win(paths, cb) { | ||
@@ -71,3 +59,3 @@ execFile('./Recycle.exe', ['-f'].concat(paths), { | ||
linux(paths, cb); | ||
xdgTrash(paths, cb); | ||
}; |
{ | ||
"name": "trash", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Cross-platform command-line app for moving files and directories to the trash - A safer alternative to `rm`", | ||
@@ -24,5 +24,3 @@ "license": "MIT", | ||
"cli.js", | ||
"vendor/cmdutils", | ||
"vendor/trash-cli/trashcli/*.py", | ||
"vendor/trash-put" | ||
"vendor/cmdutils" | ||
], | ||
@@ -48,5 +46,6 @@ "keywords": [ | ||
"escape-string-applescript": "^1.0.0", | ||
"minimist": "^1.1.0", | ||
"meow": "^1.0.0", | ||
"run-applescript": "^1.0.0", | ||
"update-notifier": "^0.2.1" | ||
"update-notifier": "^0.2.1", | ||
"xdg-trash": "^1.0.0" | ||
}, | ||
@@ -53,0 +52,0 @@ "devDependencies": { |
#  | ||
> Cross-platform command-line app for moving files and directories to the trash - A safer alternative to [`rm`](http://en.wikipedia.org/wiki/Rm_(Unix)) | ||
> Cross-platform command-line app for moving files and directories to the trash | ||
> A safer alternative to [`rm`](http://en.wikipedia.org/wiki/Rm_(Unix)) | ||
@@ -50,3 +51,3 @@ [](https://travis-ci.org/sindresorhus/trash)  | ||
On Linux [trash-cli](https://github.com/andreafrancia/trash-cli) is used. Requires Python. [Help wanted on a Node version.](https://github.com/sindresorhus/trash/issues/1) | ||
On Linux [xdg-trash](https://github.com/kevva/xdg-trash) is used. | ||
@@ -68,4 +69,9 @@ On Windows [cmdutils](http://www.maddogsw.com/cmdutils/) is used. | ||
## Related | ||
See [`empty-trash`](https://github.com/sindresorhus/empty-trash) for emptying the trash. | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
76
8.57%56523
-50.9%5
25%6
-62.5%74
-94.59%3
50%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed