Comparing version 1.1.3 to 1.2.0
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": { |
# ![trash](https://cdn.rawgit.com/sindresorhus/trash/3aa70853f1efb58d0d2512e32d617d246c88953c/media/logo.svg) | ||
> 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 @@ [![Build Status](https://travis-ci.org/sindresorhus/trash.svg?branch=master)](https://travis-ci.org/sindresorhus/trash) ![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg) | ||
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) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76
56523
5
6
74
+ Addedmeow@^1.0.0
+ Addedxdg-trash@^1.0.0
+ Added@sindresorhus/df@1.0.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcamelcase-keys@1.0.0(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedeach-async@1.1.1(transitive)
+ Addedfs-extra@0.18.4(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-stdin@4.0.1(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedindent-string@1.2.2(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedis-finite@1.1.0(transitive)
+ Addedjsonfile@2.4.0(transitive)
+ Addedmap-obj@1.0.1(transitive)
+ Addedmeow@1.0.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedmount-point@1.2.0(transitive)
+ Addedobject-assign@1.0.0(transitive)
+ Addedonetime@1.1.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedrepeating@1.1.3(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedset-immediate-shim@1.0.1(transitive)
+ Addedxdg-trash@1.1.0(transitive)
+ Addedxdg-trashdir@1.1.1(transitive)
- Removedminimist@^1.1.0