@kud/soap-cli 3.0.9 → 3.0.11

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 +29 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -242,8 +242,9 @@ var rawArgs = process.argv.slice(2);
242
242
  var firstArg = rawArgs[0];
243
243
  var param = rawArgs.find((a) => !a.startsWith("-"));
244
244
  var yes = rawArgs.includes("--yes") || rawArgs.includes("-y");
245
+ var yesDangerously = rawArgs.includes("--yes-dangerously");
245
246
  if (firstArg === "--version" || firstArg === "-v") {
246
- console.log("3.0.9");
247
+ console.log("3.0.11");
247
248
  process.exit(0);
248
249
  }
249
250
  if (!firstArg || firstArg === "--help" || firstArg === "-h") {
@@ -271,6 +272,7 @@ if (!firstArg || firstArg === "--help" || firstArg === "-h") {
271
272
 
272
273
  ${chalk.bold("Flags:")}
273
274
  ${chalk.cyan("--yes")}, ${chalk.cyan("-y")} Skip all prompts (auto-select all files, auto-confirm brew uninstall)
275
+ ${chalk.cyan("--yes-dangerously")} Like --yes, but also auto-confirms sudo rm for root-owned files
274
276
 
275
277
  ${chalk.bold("Environment:")}
276
278
  ${chalk.yellow("SOAP_DEBUG=1")} Enable verbose shell output
@@ -364,9 +366,28 @@ try {
364
366
  if (skipped.length > 0) {
365
367
  console.log("");
366
368
  signale.warn(
367
- `Skipped ${chalk.bold(skipped.length)} file(s) \u2014 no permission (may require sudo):`
369
+ `${chalk.bold(skipped.length)} file(s) require root \u2014 could not move to Trash:`
368
370
  );
369
371
  skipped.forEach((p) => console.log(` ${chalk.dim("\xB7")} ${chalk.dim(p)}`));
372
+ const { sudoDelete } = yesDangerously ? { sudoDelete: true } : await inquirer.prompt([
373
+ {
374
+ type: "confirm",
375
+ name: "sudoDelete",
376
+ message: `Run ${chalk.bold("sudo rm")} on these files?`,
377
+ default: false
378
+ }
379
+ ]);
380
+ if (sudoDelete) {
381
+ console.log("");
382
+ for (const file of skipped) {
383
+ try {
384
+ await $2`sudo rm -rf ${file}`;
385
+ signale.success(`Deleted: ${chalk.dim(file)}`);
386
+ } catch {
387
+ signale.error(`Failed to delete: ${chalk.dim(file)}`);
388
+ }
389
+ }
390
+ }
370
391
  }
371
392
  } else if (!isAppFilesEmpty) {
372
393
  signale.info("No files selected \u2014 nothing moved to Trash.");
@@ -399,12 +420,13 @@ Can you become an admin before we proceed?`,
399
420
  } catch (error) {
400
421
  const message = error instanceof Error ? error.message : "An unexpected error occurred.";
401
422
  const isPermissionError = message.includes("sudoers") || message.includes("Permission denied");
423
+ const isCaskNotInstalled = message.includes("is not installed");
402
424
  console.log("");
403
425
  signale.error(message);
404
426
  if (process.env.SOAP_DEBUG === "1") {
405
427
  console.error(error);
406
428
  }
407
- if (isCask && !isPermissionError) {
429
+ if (isCask && !isPermissionError && !isCaskNotInstalled) {
408
430
  const { forceUninstall } = await inquirer.prompt([
409
431
  {
410
432
  type: "confirm",
@@ -424,5 +446,9 @@ Force-run ${chalk.bold(`brew uninstall --zap --force ${param}`)}?`,
424
446
  signale.info(
425
447
  "Re-run with an admin account to complete the Homebrew uninstall."
426
448
  );
449
+ } else if (isCask && isCaskNotInstalled) {
450
+ signale.info(
451
+ `Cask "${param}" is not registered in Homebrew \u2014 skipping brew uninstall.`
452
+ );
427
453
  }
428
454
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/soap-cli",
3
- "version": "3.0.9",
3
+ "version": "3.0.11",
4
4
  "description": "An app cleaner cli for macOS",
5
5
  "main": "dist/index.js",
6
6
  "bin": {