@kud/soap-cli 3.0.6 → 3.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +23 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -176,7 +176,7 @@ var getCaskInfo = async (caskName) => {
176
176
  let appName = null;
177
177
  for (const artifact of caskData.artifacts) {
178
178
  if (artifact.app) {
179
- appName = artifact.app[0];
179
+ appName = artifact.app[0] || null;
180
180
  break;
181
181
  }
182
182
  }
@@ -243,7 +243,7 @@ var firstArg = rawArgs[0];
243
243
  var param = rawArgs.find((a) => !a.startsWith("-"));
244
244
  var yes = rawArgs.includes("--yes") || rawArgs.includes("-y");
245
245
  if (firstArg === "--version" || firstArg === "-v") {
246
- console.log("3.0.6");
246
+ console.log("3.0.8");
247
247
  process.exit(0);
248
248
  }
249
249
  if (!firstArg || firstArg === "--help" || firstArg === "-h") {
@@ -346,14 +346,28 @@ try {
346
346
  }
347
347
  ]);
348
348
  if (!isAppFilesEmpty && deletedFilesWish && deletedFilesWish.length > 0) {
349
- await trash(deletedFilesWish);
349
+ const skipped = [];
350
+ const moved = [];
351
+ for (const file of deletedFilesWish) {
352
+ try {
353
+ await trash(file);
354
+ moved.push(file);
355
+ } catch {
356
+ skipped.push(file);
357
+ }
358
+ }
350
359
  console.log("");
351
- signale.success(
352
- `Moved ${chalk.bold(deletedFilesWish.length)} file(s) to Trash:`
353
- );
354
- deletedFilesWish.forEach(
355
- (p) => console.log(` ${chalk.dim("\xB7")} ${chalk.dim(p)}`)
356
- );
360
+ if (moved.length > 0) {
361
+ signale.success(`Moved ${chalk.bold(moved.length)} file(s) to Trash:`);
362
+ moved.forEach((p) => console.log(` ${chalk.dim("\xB7")} ${chalk.dim(p)}`));
363
+ }
364
+ if (skipped.length > 0) {
365
+ console.log("");
366
+ signale.warn(
367
+ `Skipped ${chalk.bold(skipped.length)} file(s) \u2014 no permission (may require sudo):`
368
+ );
369
+ skipped.forEach((p) => console.log(` ${chalk.dim("\xB7")} ${chalk.dim(p)}`));
370
+ }
357
371
  } else if (!isAppFilesEmpty) {
358
372
  signale.info("No files selected \u2014 nothing moved to Trash.");
359
373
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/soap-cli",
3
- "version": "3.0.6",
3
+ "version": "3.0.8",
4
4
  "description": "An app cleaner cli for macOS",
5
5
  "main": "dist/index.js",
6
6
  "bin": {