aris-mac-cleaner 4.0.0 → 4.0.2
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.
- package/bin/cli.js +47 -392
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -114,85 +114,51 @@ try {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
// Inquirer for arrow key navigation
|
|
118
|
-
|
|
119
|
-
let useInquirer = true;
|
|
120
|
-
|
|
121
|
-
try {
|
|
122
|
-
inquirer = require('inquirer');
|
|
123
|
-
} catch (e) {
|
|
124
|
-
useInquirer = false;
|
|
125
|
-
}
|
|
117
|
+
// Inquirer for arrow key navigation (required)
|
|
118
|
+
const inquirer = require('inquirer');
|
|
126
119
|
|
|
127
120
|
// ============================================================================
|
|
128
121
|
// INQUIRER HELPER FUNCTIONS
|
|
129
122
|
// ============================================================================
|
|
130
123
|
|
|
131
|
-
async function selectOption(message, choices
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}]);
|
|
142
|
-
return selection;
|
|
143
|
-
} catch (e) {
|
|
144
|
-
if (fallbackPromptFn) return fallbackPromptFn();
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (fallbackPromptFn) return fallbackPromptFn();
|
|
149
|
-
return null;
|
|
124
|
+
async function selectOption(message, choices) {
|
|
125
|
+
const { selection } = await inquirer.prompt([{
|
|
126
|
+
type: 'list',
|
|
127
|
+
name: 'selection',
|
|
128
|
+
message: message,
|
|
129
|
+
choices: choices,
|
|
130
|
+
loop: false,
|
|
131
|
+
pageSize: 20
|
|
132
|
+
}]);
|
|
133
|
+
return selection;
|
|
150
134
|
}
|
|
151
135
|
|
|
152
|
-
async function selectMultiple(message, choices
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}]);
|
|
162
|
-
return selections;
|
|
163
|
-
} catch (e) {
|
|
164
|
-
if (fallbackPromptFn) return fallbackPromptFn();
|
|
165
|
-
return [];
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (fallbackPromptFn) return fallbackPromptFn();
|
|
169
|
-
return [];
|
|
136
|
+
async function selectMultiple(message, choices) {
|
|
137
|
+
const { selections } = await inquirer.prompt([{
|
|
138
|
+
type: 'checkbox',
|
|
139
|
+
name: 'selections',
|
|
140
|
+
message: message,
|
|
141
|
+
choices: choices,
|
|
142
|
+
pageSize: 20
|
|
143
|
+
}]);
|
|
144
|
+
return selections;
|
|
170
145
|
}
|
|
171
146
|
|
|
172
|
-
async function confirmAction(message, defaultValue = false
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}]);
|
|
181
|
-
return confirmed;
|
|
182
|
-
} catch (e) {
|
|
183
|
-
if (fallbackPromptFn) return fallbackPromptFn();
|
|
184
|
-
return defaultValue;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (fallbackPromptFn) return fallbackPromptFn();
|
|
188
|
-
return defaultValue;
|
|
147
|
+
async function confirmAction(message, defaultValue = false) {
|
|
148
|
+
const { confirmed } = await inquirer.prompt([{
|
|
149
|
+
type: 'confirm',
|
|
150
|
+
name: 'confirmed',
|
|
151
|
+
message: message,
|
|
152
|
+
default: defaultValue
|
|
153
|
+
}]);
|
|
154
|
+
return confirmed;
|
|
189
155
|
}
|
|
190
156
|
|
|
191
157
|
// ============================================================================
|
|
192
158
|
// CONSTANTS
|
|
193
159
|
// ============================================================================
|
|
194
160
|
|
|
195
|
-
const VERSION = '4.0.
|
|
161
|
+
const VERSION = '4.0.2';
|
|
196
162
|
const PACKAGE_NAME = 'aris-mac-cleaner';
|
|
197
163
|
const HOME = os.homedir();
|
|
198
164
|
const CONFIG_DIR = path.join(HOME, '.aris-mac-cleaner');
|
|
@@ -721,27 +687,8 @@ async function askConfirmationMode() {
|
|
|
721
687
|
{ name: chalk.blue(MSG.CONFIRM_DRYRUN), value: 'dryrun' }
|
|
722
688
|
];
|
|
723
689
|
|
|
724
|
-
const fallback = async () => {
|
|
725
|
-
console.log();
|
|
726
|
-
console.log(chalk.cyan(' +-------------------------------------+'));
|
|
727
|
-
console.log(chalk.cyan(' | ') + chalk.white(MSG.CONFIRM_MODE.padEnd(35)) + chalk.cyan('|'));
|
|
728
|
-
console.log(chalk.cyan(' | |'));
|
|
729
|
-
console.log(chalk.cyan(' | ') + chalk.green('[a]') + chalk.white(' ' + MSG.CONFIRM_AUTO.padEnd(30)) + chalk.cyan('|'));
|
|
730
|
-
console.log(chalk.cyan(' | ') + chalk.yellow('[m]') + chalk.white(' ' + MSG.CONFIRM_MANUAL.padEnd(30)) + chalk.cyan('|'));
|
|
731
|
-
console.log(chalk.cyan(' | ') + chalk.blue('[d]') + chalk.white(' ' + MSG.CONFIRM_DRYRUN.padEnd(30)) + chalk.cyan('|'));
|
|
732
|
-
console.log(chalk.cyan(' | |'));
|
|
733
|
-
console.log(chalk.cyan(' +-------------------------------------+'));
|
|
734
|
-
console.log();
|
|
735
|
-
const c = await prompt(` ${chalk.white(MSG.CONFIRM_CHOOSE)} `);
|
|
736
|
-
switch (c.toLowerCase()) {
|
|
737
|
-
case 'm': return 'manual';
|
|
738
|
-
case 'd': return 'dryrun';
|
|
739
|
-
default: return 'auto';
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
|
|
743
690
|
console.log();
|
|
744
|
-
return await selectOption(MSG.CONFIRM_MODE, choices
|
|
691
|
+
return await selectOption(MSG.CONFIRM_MODE, choices);
|
|
745
692
|
}
|
|
746
693
|
|
|
747
694
|
async function confirmItem(itemPath, itemSize) {
|
|
@@ -755,18 +702,8 @@ async function confirmItem(itemPath, itemSize) {
|
|
|
755
702
|
{ name: LANG_CODE === 'pt' ? 'Aceitar restantes' : 'Accept all remaining', value: 'all' }
|
|
756
703
|
];
|
|
757
704
|
|
|
758
|
-
const fallback = async () => {
|
|
759
|
-
console.log();
|
|
760
|
-
console.log(` ${chalk.yellow(MSG.CONFIRM_ITEM)} ${chalk.white(shortPath)} ${chalk.dim('(' + formatSize(itemSize) + ')')}`);
|
|
761
|
-
const answer = await prompt(` ${chalk.dim(MSG.CONFIRM_YES_NO_ALL)} `);
|
|
762
|
-
const yesKeys = LANG_CODE === 'pt' ? ['s', 'sim'] : ['y', 'yes'];
|
|
763
|
-
if (['a'].includes(answer.toLowerCase())) return 'all';
|
|
764
|
-
if (yesKeys.includes(answer.toLowerCase())) return 'yes';
|
|
765
|
-
return 'no';
|
|
766
|
-
};
|
|
767
|
-
|
|
768
705
|
console.log();
|
|
769
|
-
return await selectOption(`${MSG.CONFIRM_ITEM} ${itemDisplay}`, choices
|
|
706
|
+
return await selectOption(`${MSG.CONFIRM_ITEM} ${itemDisplay}`, choices);
|
|
770
707
|
}
|
|
771
708
|
|
|
772
709
|
function showCleanupSummary(deleted, skipped, freedSize, mode) {
|
|
@@ -1356,30 +1293,9 @@ async function privacySweep() {
|
|
|
1356
1293
|
short: item.name
|
|
1357
1294
|
}));
|
|
1358
1295
|
|
|
1359
|
-
// Fallback for text-based selection
|
|
1360
|
-
const fallbackSelect = async () => {
|
|
1361
|
-
console.log(chalk.dim(` ${MSG.SELECT_DELETE} [a=${MSG.ALL}/numbers/n=${MSG.CANCEL}]:`));
|
|
1362
|
-
const choice = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
1363
|
-
|
|
1364
|
-
if (choice.toLowerCase() === 'n' || choice === '') return [];
|
|
1365
|
-
|
|
1366
|
-
if (choice.toLowerCase() === 'a') {
|
|
1367
|
-
return items.map(item => item.fullPath);
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
const selected = [];
|
|
1371
|
-
const parts = choice.split(',');
|
|
1372
|
-
parts.forEach(part => {
|
|
1373
|
-
const idx = parseInt(part.trim()) - 1;
|
|
1374
|
-
if (idx >= 0 && idx < items.length) selected.push(items[idx].fullPath);
|
|
1375
|
-
});
|
|
1376
|
-
return selected;
|
|
1377
|
-
};
|
|
1378
|
-
|
|
1379
1296
|
const selectedPaths = await selectMultiple(
|
|
1380
1297
|
`${MSG.SELECT_DELETE} ${chalk.dim('(space to select, enter to confirm)')}`,
|
|
1381
|
-
itemChoices
|
|
1382
|
-
fallbackSelect
|
|
1298
|
+
itemChoices
|
|
1383
1299
|
);
|
|
1384
1300
|
|
|
1385
1301
|
if (selectedPaths.length === 0) {
|
|
@@ -1476,12 +1392,7 @@ async function memoryOptimizer() {
|
|
|
1476
1392
|
console.log(chalk.dim(' You may need to enter your password.'));
|
|
1477
1393
|
console.log();
|
|
1478
1394
|
|
|
1479
|
-
const
|
|
1480
|
-
const answer = await prompt(` ${chalk.white('Continue? [y/n]:')} `);
|
|
1481
|
-
return answer.toLowerCase() === 'y';
|
|
1482
|
-
};
|
|
1483
|
-
|
|
1484
|
-
const confirmed = await confirmAction('Continue with memory optimization?', false, fallbackConfirm);
|
|
1395
|
+
const confirmed = await confirmAction('Continue with memory optimization?', false);
|
|
1485
1396
|
|
|
1486
1397
|
if (!confirmed) {
|
|
1487
1398
|
await pressEnter();
|
|
@@ -1768,12 +1679,7 @@ async function thermalMonitor() {
|
|
|
1768
1679
|
// Ask about detailed power info
|
|
1769
1680
|
console.log(chalk.yellow(` ${figures.info} ${MSG.THERMAL_DETAILED}`));
|
|
1770
1681
|
|
|
1771
|
-
const
|
|
1772
|
-
const answer = await prompt(` ${chalk.white('[y/n]:')} `);
|
|
1773
|
-
return answer.toLowerCase() === 'y';
|
|
1774
|
-
};
|
|
1775
|
-
|
|
1776
|
-
const wantDetails = await confirmAction('View detailed power metrics?', false, fallbackThermal);
|
|
1682
|
+
const wantDetails = await confirmAction('View detailed power metrics?', false);
|
|
1777
1683
|
|
|
1778
1684
|
if (wantDetails) {
|
|
1779
1685
|
console.log();
|
|
@@ -1859,27 +1765,7 @@ async function scheduler() {
|
|
|
1859
1765
|
];
|
|
1860
1766
|
}
|
|
1861
1767
|
|
|
1862
|
-
const
|
|
1863
|
-
if (isScheduled) {
|
|
1864
|
-
console.log(` ${chalk.cyan('[1]')} Remove schedule`);
|
|
1865
|
-
console.log(` ${chalk.cyan('[2]')} View current schedule`);
|
|
1866
|
-
} else {
|
|
1867
|
-
console.log(` ${chalk.cyan('[1]')} Schedule daily cleanup (midnight)`);
|
|
1868
|
-
console.log(` ${chalk.cyan('[2]')} Schedule weekly cleanup (Sunday midnight)`);
|
|
1869
|
-
}
|
|
1870
|
-
console.log();
|
|
1871
|
-
console.log(` ${chalk.cyan('[0]')} ${MSG.BACK}`);
|
|
1872
|
-
console.log();
|
|
1873
|
-
const c = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
1874
|
-
if (c === '0') return 'back';
|
|
1875
|
-
if (isScheduled) {
|
|
1876
|
-
return c === '1' ? 'remove' : c === '2' ? 'view' : 'back';
|
|
1877
|
-
} else {
|
|
1878
|
-
return c === '1' ? 'daily' : c === '2' ? 'weekly' : 'back';
|
|
1879
|
-
}
|
|
1880
|
-
};
|
|
1881
|
-
|
|
1882
|
-
const choice = await selectOption(MSG.OPT_SCHEDULER, schedulerChoices, fallbackScheduler);
|
|
1768
|
+
const choice = await selectOption(MSG.OPT_SCHEDULER, schedulerChoices);
|
|
1883
1769
|
|
|
1884
1770
|
if (choice === 'back' || !choice) {
|
|
1885
1771
|
return;
|
|
@@ -2129,12 +2015,7 @@ async function exportHtmlReport() {
|
|
|
2129
2015
|
console.log(chalk.dim(` ${reportPath}`));
|
|
2130
2016
|
console.log();
|
|
2131
2017
|
|
|
2132
|
-
const
|
|
2133
|
-
const answer = await prompt(` Open in browser? [y/n]: `);
|
|
2134
|
-
return answer.toLowerCase() === 'y';
|
|
2135
|
-
};
|
|
2136
|
-
|
|
2137
|
-
const shouldOpen = await confirmAction('Open report in browser?', false, fallbackOpen);
|
|
2018
|
+
const shouldOpen = await confirmAction('Open report in browser?', false);
|
|
2138
2019
|
if (shouldOpen) {
|
|
2139
2020
|
exec(`open "${reportPath}"`);
|
|
2140
2021
|
}
|
|
@@ -2355,43 +2236,9 @@ async function quickClean() {
|
|
|
2355
2236
|
short: item.name
|
|
2356
2237
|
}));
|
|
2357
2238
|
|
|
2358
|
-
// Fallback for text-based selection
|
|
2359
|
-
const fallbackQuickSelect = async () => {
|
|
2360
|
-
sectionHeader(MSG.SELECT_DELETE);
|
|
2361
|
-
console.log(chalk.dim(` a = ${MSG.ALL} | n = ${MSG.CANCEL} | 1,3,5 | 1-5 | 1-5,8,10`));
|
|
2362
|
-
console.log();
|
|
2363
|
-
|
|
2364
|
-
const choice = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
2365
|
-
|
|
2366
|
-
if (choice.toLowerCase() === 'n' || choice === '') {
|
|
2367
|
-
return [];
|
|
2368
|
-
}
|
|
2369
|
-
|
|
2370
|
-
if (choice.toLowerCase() === 'a') {
|
|
2371
|
-
return items.map(item => item.path);
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
const selected = [];
|
|
2375
|
-
const parts = choice.split(',');
|
|
2376
|
-
parts.forEach(part => {
|
|
2377
|
-
part = part.trim();
|
|
2378
|
-
if (part.includes('-')) {
|
|
2379
|
-
const [start, end] = part.split('-').map(n => parseInt(n));
|
|
2380
|
-
for (let j = start; j <= end; j++) {
|
|
2381
|
-
if (j > 0 && j <= items.length) selected.push(items[j - 1].path);
|
|
2382
|
-
}
|
|
2383
|
-
} else {
|
|
2384
|
-
const idx = parseInt(part) - 1;
|
|
2385
|
-
if (idx >= 0 && idx < items.length) selected.push(items[idx].path);
|
|
2386
|
-
}
|
|
2387
|
-
});
|
|
2388
|
-
return selected;
|
|
2389
|
-
};
|
|
2390
|
-
|
|
2391
2239
|
const selectedPaths = await selectMultiple(
|
|
2392
2240
|
`${MSG.SELECT_DELETE} ${chalk.dim('(space to toggle, enter to confirm)')}`,
|
|
2393
|
-
itemChoices
|
|
2394
|
-
fallbackQuickSelect
|
|
2241
|
+
itemChoices
|
|
2395
2242
|
);
|
|
2396
2243
|
|
|
2397
2244
|
if (selectedPaths.length === 0) {
|
|
@@ -2559,12 +2406,7 @@ async function deepClean() {
|
|
|
2559
2406
|
console.log(chalk.yellow(` ${MSG.DEEP_CLEAN_TIME}`));
|
|
2560
2407
|
console.log();
|
|
2561
2408
|
|
|
2562
|
-
const
|
|
2563
|
-
const answer = await prompt(` ${chalk.white(MSG.DEEP_CLEAN_CONFIRM + ' [y/n]:')} `);
|
|
2564
|
-
return answer.toLowerCase() === 'y';
|
|
2565
|
-
};
|
|
2566
|
-
|
|
2567
|
-
const confirmDeep = await confirmAction(MSG.DEEP_CLEAN_CONFIRM, false, fallbackDeepConfirm);
|
|
2409
|
+
const confirmDeep = await confirmAction(MSG.DEEP_CLEAN_CONFIRM, false);
|
|
2568
2410
|
if (!confirmDeep) {
|
|
2569
2411
|
console.log(` ${chalk.yellow(MSG.CANCEL)}`);
|
|
2570
2412
|
await pressEnter();
|
|
@@ -3096,50 +2938,12 @@ async function findLargeFiles() {
|
|
|
3096
2938
|
};
|
|
3097
2939
|
});
|
|
3098
2940
|
|
|
3099
|
-
// Fallback for text-based selection
|
|
3100
|
-
const fallbackSelect = async () => {
|
|
3101
|
-
files.forEach((file, i) => {
|
|
3102
|
-
let displayFile = file.path.replace(HOME, '~');
|
|
3103
|
-
if (displayFile.length > 50) {
|
|
3104
|
-
displayFile = '...' + displayFile.slice(-47);
|
|
3105
|
-
}
|
|
3106
|
-
console.log(` ${chalk.cyan('[' + String(i + 1).padStart(2) + ']')} ${chalk.dim(String(file.size).padStart(6) + ' MB')} ${displayFile}`);
|
|
3107
|
-
});
|
|
3108
|
-
console.log();
|
|
3109
|
-
console.log(` ${figures.arrowRight} ${chalk.white(MSG.TOTAL + ':')} ${chalk.green(formatSize(totalLarge))} ${chalk.dim('(' + files.length + ' files)')}`);
|
|
3110
|
-
console.log();
|
|
3111
|
-
console.log(chalk.dim(` ${MSG.SELECT_DELETE} [numbers/a/n]:`));
|
|
3112
|
-
const choice = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
3113
|
-
|
|
3114
|
-
if (choice.toLowerCase() === 'n' || choice === '') return [];
|
|
3115
|
-
|
|
3116
|
-
const selected = new Array(files.length).fill(false);
|
|
3117
|
-
if (choice.toLowerCase() === 'a') {
|
|
3118
|
-
selected.fill(true);
|
|
3119
|
-
} else {
|
|
3120
|
-
choice.split(',').forEach(part => {
|
|
3121
|
-
part = part.trim();
|
|
3122
|
-
if (part.includes('-')) {
|
|
3123
|
-
const [start, end] = part.split('-').map(n => parseInt(n));
|
|
3124
|
-
for (let j = start; j <= end; j++) {
|
|
3125
|
-
if (j > 0 && j <= files.length) selected[j - 1] = true;
|
|
3126
|
-
}
|
|
3127
|
-
} else {
|
|
3128
|
-
const idx = parseInt(part) - 1;
|
|
3129
|
-
if (idx >= 0 && idx < files.length) selected[idx] = true;
|
|
3130
|
-
}
|
|
3131
|
-
});
|
|
3132
|
-
}
|
|
3133
|
-
return files.filter((f, i) => selected[i]).map(f => f.path);
|
|
3134
|
-
};
|
|
3135
|
-
|
|
3136
2941
|
console.log(` ${figures.arrowRight} ${chalk.white(MSG.TOTAL + ':')} ${chalk.green(formatSize(totalLarge))} ${chalk.dim('(' + files.length + ' files)')}`);
|
|
3137
2942
|
console.log();
|
|
3138
2943
|
|
|
3139
2944
|
const selectedPaths = await selectMultiple(
|
|
3140
2945
|
`${MSG.SELECT_DELETE} ${chalk.dim('(space to select, enter to confirm)')}`,
|
|
3141
|
-
fileChoices
|
|
3142
|
-
fallbackSelect
|
|
2946
|
+
fileChoices
|
|
3143
2947
|
);
|
|
3144
2948
|
|
|
3145
2949
|
if (selectedPaths.length === 0) {
|
|
@@ -3293,24 +3097,9 @@ async function findDuplicates() {
|
|
|
3293
3097
|
};
|
|
3294
3098
|
});
|
|
3295
3099
|
|
|
3296
|
-
const fallbackKeep = async () => {
|
|
3297
|
-
group.files.forEach((file, idx) => {
|
|
3298
|
-
let display = file.replace(HOME, '~');
|
|
3299
|
-
if (display.length > 50) display = '...' + display.slice(-47);
|
|
3300
|
-
console.log(` ${chalk.cyan('[' + (idx + 1) + ']')} ${display}`);
|
|
3301
|
-
});
|
|
3302
|
-
console.log();
|
|
3303
|
-
console.log(chalk.dim(` ${MSG.SELECT_KEEP} [numbers, default: 1]:`));
|
|
3304
|
-
const choice = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
3305
|
-
if (!choice || choice === '1') return [group.files[0]];
|
|
3306
|
-
const indices = choice.split(',').map(n => parseInt(n.trim()) - 1).filter(n => n >= 0 && n < group.files.length);
|
|
3307
|
-
return indices.length > 0 ? indices.map(i => group.files[i]) : [group.files[0]];
|
|
3308
|
-
};
|
|
3309
|
-
|
|
3310
3100
|
const keepFiles = await selectMultiple(
|
|
3311
3101
|
`${MSG.SELECT_KEEP} ${chalk.dim('(space to select files to KEEP)')}`,
|
|
3312
|
-
fileChoices
|
|
3313
|
-
fallbackKeep
|
|
3102
|
+
fileChoices
|
|
3314
3103
|
);
|
|
3315
3104
|
|
|
3316
3105
|
// Files not in keepFiles will be deleted
|
|
@@ -3418,35 +3207,9 @@ async function uninstallApps() {
|
|
|
3418
3207
|
short: app.name
|
|
3419
3208
|
}));
|
|
3420
3209
|
|
|
3421
|
-
// Fallback for text-based selection
|
|
3422
|
-
const fallbackAppSelect = async () => {
|
|
3423
|
-
apps.forEach((app, i) => {
|
|
3424
|
-
console.log(` ${chalk.cyan('[' + String(i + 1).padStart(2) + ']')} ${app.name.padEnd(25)} ${chalk.dim('(' + String(app.appSize).padStart(3) + ' MB ' + MSG.APP_SIZE + ' + ' + String(app.dataSize).padStart(3) + ' MB ' + MSG.DATA_SIZE + ')')}`);
|
|
3425
|
-
});
|
|
3426
|
-
|
|
3427
|
-
console.log();
|
|
3428
|
-
console.log(chalk.dim(` ${MSG.SELECT_DELETE} [numbers/n]:`));
|
|
3429
|
-
const choice = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
3430
|
-
|
|
3431
|
-
if (choice.toLowerCase() === 'n' || choice === '') {
|
|
3432
|
-
return [];
|
|
3433
|
-
}
|
|
3434
|
-
|
|
3435
|
-
const selected = [];
|
|
3436
|
-
const parts = choice.split(',');
|
|
3437
|
-
for (const part of parts) {
|
|
3438
|
-
const idx = parseInt(part.trim()) - 1;
|
|
3439
|
-
if (idx >= 0 && idx < apps.length) {
|
|
3440
|
-
selected.push(apps[idx].path);
|
|
3441
|
-
}
|
|
3442
|
-
}
|
|
3443
|
-
return selected;
|
|
3444
|
-
};
|
|
3445
|
-
|
|
3446
3210
|
const selectedPaths = await selectMultiple(
|
|
3447
3211
|
`${MSG.SELECT_DELETE} ${chalk.dim('(space to select, enter to confirm)')}`,
|
|
3448
|
-
appChoices
|
|
3449
|
-
fallbackAppSelect
|
|
3212
|
+
appChoices
|
|
3450
3213
|
);
|
|
3451
3214
|
|
|
3452
3215
|
if (selectedPaths.length === 0) {
|
|
@@ -3585,14 +3348,7 @@ async function manageStartup() {
|
|
|
3585
3348
|
{ name: chalk.yellow(MSG.BACK), value: 'back' }
|
|
3586
3349
|
];
|
|
3587
3350
|
|
|
3588
|
-
const
|
|
3589
|
-
console.log(chalk.dim(" Enter 'd' to disable all, or 'n' to go back"));
|
|
3590
|
-
const choice = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
3591
|
-
if (choice.toLowerCase() === 'd') return 'disable_all';
|
|
3592
|
-
return 'back';
|
|
3593
|
-
};
|
|
3594
|
-
|
|
3595
|
-
const choice = await selectOption(MSG.STARTUP_ITEMS, startupChoices, fallbackStartup);
|
|
3351
|
+
const choice = await selectOption(MSG.STARTUP_ITEMS, startupChoices);
|
|
3596
3352
|
|
|
3597
3353
|
if (choice === 'disable_all') {
|
|
3598
3354
|
exec(`osascript -e 'tell application "System Events" to delete every login item' 2>/dev/null`);
|
|
@@ -3654,36 +3410,9 @@ async function cleanBrowsers() {
|
|
|
3654
3410
|
short: item.name
|
|
3655
3411
|
}));
|
|
3656
3412
|
|
|
3657
|
-
// Fallback for text-based selection
|
|
3658
|
-
const fallbackBrowserSelect = async () => {
|
|
3659
|
-
items.forEach((item, i) => {
|
|
3660
|
-
console.log(` ${chalk.cyan('[' + String(i + 1).padStart(2) + ']')} ${item.name.padEnd(30)} ${chalk.dim(String(item.size).padStart(6) + ' MB')}`);
|
|
3661
|
-
});
|
|
3662
|
-
console.log();
|
|
3663
|
-
console.log(chalk.dim(` ${MSG.SELECT_DELETE} [numbers/a/n]:`));
|
|
3664
|
-
const choice = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
3665
|
-
|
|
3666
|
-
if (choice.toLowerCase() === 'n' || choice === '') {
|
|
3667
|
-
return [];
|
|
3668
|
-
}
|
|
3669
|
-
|
|
3670
|
-
if (choice.toLowerCase() === 'a') {
|
|
3671
|
-
return items.map(item => item.path);
|
|
3672
|
-
}
|
|
3673
|
-
|
|
3674
|
-
const selected = [];
|
|
3675
|
-
const parts = choice.split(',');
|
|
3676
|
-
parts.forEach(part => {
|
|
3677
|
-
const idx = parseInt(part.trim()) - 1;
|
|
3678
|
-
if (idx >= 0 && idx < items.length) selected.push(items[idx].path);
|
|
3679
|
-
});
|
|
3680
|
-
return selected;
|
|
3681
|
-
};
|
|
3682
|
-
|
|
3683
3413
|
const selectedPaths = await selectMultiple(
|
|
3684
3414
|
`${MSG.SELECT_DELETE} ${chalk.dim('(space to select, enter to confirm)')}`,
|
|
3685
|
-
browserChoices
|
|
3686
|
-
fallbackBrowserSelect
|
|
3415
|
+
browserChoices
|
|
3687
3416
|
);
|
|
3688
3417
|
|
|
3689
3418
|
if (selectedPaths.length === 0) {
|
|
@@ -3805,22 +3534,7 @@ async function killProcesses() {
|
|
|
3805
3534
|
}));
|
|
3806
3535
|
processChoices.push({ name: chalk.yellow(MSG.BACK), value: 'back' });
|
|
3807
3536
|
|
|
3808
|
-
const
|
|
3809
|
-
console.log(chalk.dim(` ${MSG.KILL} process [number/n]:`));
|
|
3810
|
-
const choice = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
3811
|
-
|
|
3812
|
-
if (choice.toLowerCase() === 'n' || choice === '') {
|
|
3813
|
-
return 'back';
|
|
3814
|
-
}
|
|
3815
|
-
|
|
3816
|
-
const idx = parseInt(choice) - 1;
|
|
3817
|
-
if (idx >= 0 && idx < procs.length) {
|
|
3818
|
-
return procs[idx].pid;
|
|
3819
|
-
}
|
|
3820
|
-
return 'back';
|
|
3821
|
-
};
|
|
3822
|
-
|
|
3823
|
-
const selectedPid = await selectOption(`${MSG.KILL} process`, processChoices, fallbackProcess);
|
|
3537
|
+
const selectedPid = await selectOption(`${MSG.KILL} process`, processChoices);
|
|
3824
3538
|
|
|
3825
3539
|
if (selectedPid === 'back' || !selectedPid) {
|
|
3826
3540
|
await pressEnter();
|
|
@@ -3870,23 +3584,7 @@ async function showSettings() {
|
|
|
3870
3584
|
{ name: chalk.yellow(MSG.BACK), value: 'back' }
|
|
3871
3585
|
];
|
|
3872
3586
|
|
|
3873
|
-
const
|
|
3874
|
-
console.log(` ${chalk.cyan('[1]')} ${MSG.EXCLUSIONS}`);
|
|
3875
|
-
console.log(` ${chalk.cyan('[2]')} ${MSG.CUSTOM_PATHS}`);
|
|
3876
|
-
console.log(` ${chalk.cyan('[3]')} ${MSG.CHANGE_LANG} (current: ${currentLang})`);
|
|
3877
|
-
console.log(` ${chalk.cyan('[4]')} ${MSG.RESET_DEFAULTS}`);
|
|
3878
|
-
console.log(` ${chalk.cyan('[5]')} ${DRY_RUN ? chalk.green(figures.tick) : figures.radioOff} Dry-Run Mode`);
|
|
3879
|
-
console.log(` ${chalk.cyan('[6]')} ${SECURE_DELETE ? chalk.green(figures.tick) : figures.radioOff} Secure Delete Mode`);
|
|
3880
|
-
console.log(` ${chalk.cyan('[7]')} View Backups`);
|
|
3881
|
-
console.log();
|
|
3882
|
-
console.log(` ${chalk.cyan('[0]')} ${MSG.BACK}`);
|
|
3883
|
-
console.log();
|
|
3884
|
-
const c = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
3885
|
-
const map = { '1': 'exclusions', '2': 'paths', '3': 'lang', '4': 'reset', '5': 'dryrun', '6': 'secure', '7': 'backups', '0': 'back' };
|
|
3886
|
-
return map[c] || null;
|
|
3887
|
-
};
|
|
3888
|
-
|
|
3889
|
-
const choice = await selectOption(MSG.OPT_SETTINGS, settingsChoices, fallbackSettings);
|
|
3587
|
+
const choice = await selectOption(MSG.OPT_SETTINGS, settingsChoices);
|
|
3890
3588
|
|
|
3891
3589
|
switch (choice) {
|
|
3892
3590
|
case 'exclusions':
|
|
@@ -4040,52 +3738,9 @@ async function mainMenu() {
|
|
|
4040
3738
|
{ name: chalk.red(MSG.OPT_EXIT), value: 'exit' }
|
|
4041
3739
|
];
|
|
4042
3740
|
|
|
4043
|
-
// Fallback for when inquirer is not available
|
|
4044
|
-
const fallbackMenu = async () => {
|
|
4045
|
-
// Box drawing characters
|
|
4046
|
-
const boxChars = {
|
|
4047
|
-
topLeft: '\u256D', topRight: '\u256E', bottomLeft: '\u2570', bottomRight: '\u256F',
|
|
4048
|
-
horizontal: '\u2500', vertical: '\u2502', horizontalDouble: '\u2550', cross: '\u2560', crossRight: '\u2563'
|
|
4049
|
-
};
|
|
4050
|
-
console.log(chalk.cyan(`${boxChars.topLeft}${''.padEnd(38, boxChars.horizontal)}${boxChars.topRight}`));
|
|
4051
|
-
console.log(chalk.cyan(boxChars.vertical) + chalk.white.bold(' \uD83E\uDDF9 ARIS MAC CLEANER v' + VERSION) + ' '.repeat(11) + chalk.cyan(boxChars.vertical));
|
|
4052
|
-
console.log(chalk.cyan(boxChars.cross) + chalk.cyan(''.padEnd(38, boxChars.horizontalDouble)) + chalk.cyan(boxChars.crossRight));
|
|
4053
|
-
console.log(chalk.cyan(boxChars.vertical) + ' '.repeat(38) + chalk.cyan(boxChars.vertical));
|
|
4054
|
-
console.log(chalk.cyan(boxChars.vertical) + chalk.yellow(' \u2500\u2500 \uD83E\uDDF9 ' + MSG.SECTION_CLEANING + ' ') + '\u2500'.repeat(38 - 10 - MSG.SECTION_CLEANING.length) + chalk.cyan(boxChars.vertical));
|
|
4055
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[1]')} ${MSG.OPT_QUICK}` + ' '.repeat(38 - 7 - MSG.OPT_QUICK.length) + chalk.cyan(boxChars.vertical));
|
|
4056
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[2]')} ${MSG.OPT_DEEP} ${chalk.red('\uD83D\uDD25')}` + ' '.repeat(38 - 11 - MSG.OPT_DEEP.length) + chalk.cyan(boxChars.vertical));
|
|
4057
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[3]')} ${MSG.OPT_LARGE}` + ' '.repeat(38 - 7 - MSG.OPT_LARGE.length) + chalk.cyan(boxChars.vertical));
|
|
4058
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[4]')} ${MSG.OPT_DUPLICATES}` + ' '.repeat(38 - 7 - MSG.OPT_DUPLICATES.length) + chalk.cyan(boxChars.vertical));
|
|
4059
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[5]')} ${MSG.OPT_APPS}` + ' '.repeat(38 - 7 - MSG.OPT_APPS.length) + chalk.cyan(boxChars.vertical));
|
|
4060
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[6]')} ${MSG.OPT_BROWSERS}` + ' '.repeat(38 - 7 - MSG.OPT_BROWSERS.length) + chalk.cyan(boxChars.vertical));
|
|
4061
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[7]')} ${MSG.OPT_PRIVACY}` + ' '.repeat(38 - 7 - MSG.OPT_PRIVACY.length) + chalk.cyan(boxChars.vertical));
|
|
4062
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[8]')} ${MSG.OPT_MEMORY}` + ' '.repeat(38 - 7 - MSG.OPT_MEMORY.length) + chalk.cyan(boxChars.vertical));
|
|
4063
|
-
console.log(chalk.cyan(boxChars.vertical) + ' '.repeat(38) + chalk.cyan(boxChars.vertical));
|
|
4064
|
-
console.log(chalk.cyan(boxChars.vertical) + chalk.yellow(' \u2500\u2500 \uD83D\uDCCA ' + MSG.SECTION_ANALYSIS + ' ') + '\u2500'.repeat(38 - 10 - MSG.SECTION_ANALYSIS.length) + chalk.cyan(boxChars.vertical));
|
|
4065
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[9]')} ${MSG.OPT_STATS}` + ' '.repeat(38 - 7 - MSG.OPT_STATS.length) + chalk.cyan(boxChars.vertical));
|
|
4066
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[10]')} ${MSG.OPT_THERMAL}` + ' '.repeat(38 - 8 - MSG.OPT_THERMAL.length) + chalk.cyan(boxChars.vertical));
|
|
4067
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[11]')} ${MSG.OPT_DISK}` + ' '.repeat(38 - 8 - MSG.OPT_DISK.length) + chalk.cyan(boxChars.vertical));
|
|
4068
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[12]')} ${MSG.OPT_BENCHMARK}` + ' '.repeat(38 - 8 - MSG.OPT_BENCHMARK.length) + chalk.cyan(boxChars.vertical));
|
|
4069
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[13]')} ${MSG.OPT_PROCESSES}` + ' '.repeat(38 - 8 - MSG.OPT_PROCESSES.length) + chalk.cyan(boxChars.vertical));
|
|
4070
|
-
console.log(chalk.cyan(boxChars.vertical) + ' '.repeat(38) + chalk.cyan(boxChars.vertical));
|
|
4071
|
-
console.log(chalk.cyan(boxChars.vertical) + chalk.yellow(' \u2500\u2500 \u2699\uFE0F ' + MSG.SECTION_SETTINGS + ' ') + '\u2500'.repeat(38 - 11 - MSG.SECTION_SETTINGS.length) + chalk.cyan(boxChars.vertical));
|
|
4072
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[14]')} ${MSG.OPT_STARTUP}` + ' '.repeat(38 - 8 - MSG.OPT_STARTUP.length) + chalk.cyan(boxChars.vertical));
|
|
4073
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[15]')} ${MSG.OPT_SCHEDULER}` + ' '.repeat(38 - 8 - MSG.OPT_SCHEDULER.length) + chalk.cyan(boxChars.vertical));
|
|
4074
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[16]')} ${MSG.OPT_SETTINGS}` + ' '.repeat(38 - 8 - MSG.OPT_SETTINGS.length) + chalk.cyan(boxChars.vertical));
|
|
4075
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[17]')} ${MSG.OPT_EXPORT}` + ' '.repeat(38 - 8 - MSG.OPT_EXPORT.length) + chalk.cyan(boxChars.vertical));
|
|
4076
|
-
console.log(chalk.cyan(boxChars.vertical) + ' '.repeat(38) + chalk.cyan(boxChars.vertical));
|
|
4077
|
-
console.log(chalk.cyan(boxChars.vertical) + ` ${chalk.cyan('[0]')} ${MSG.OPT_EXIT}` + ' '.repeat(38 - 7 - MSG.OPT_EXIT.length) + chalk.cyan(boxChars.vertical));
|
|
4078
|
-
console.log(chalk.cyan(`${boxChars.bottomLeft}${''.padEnd(38, boxChars.horizontal)}${boxChars.bottomRight}`));
|
|
4079
|
-
console.log();
|
|
4080
|
-
const c = await prompt(` ${chalk.white(MSG.CHOOSE + ':')} `);
|
|
4081
|
-
const map = { '1': 'quick', '2': 'deep', '3': 'large', '4': 'duplicates', '5': 'apps', '6': 'browsers', '7': 'privacy', '8': 'memory', '9': 'stats', '10': 'thermal', '11': 'disk', '12': 'benchmark', '13': 'processes', '14': 'startup', '15': 'scheduler', '16': 'settings', '17': 'export', '0': 'exit' };
|
|
4082
|
-
return map[c] || null;
|
|
4083
|
-
};
|
|
4084
|
-
|
|
4085
3741
|
const choice = await selectOption(
|
|
4086
3742
|
chalk.cyan('\uD83E\uDDF9 ARIS MAC CLEANER v' + VERSION),
|
|
4087
|
-
menuChoices
|
|
4088
|
-
fallbackMenu
|
|
3743
|
+
menuChoices
|
|
4089
3744
|
);
|
|
4090
3745
|
|
|
4091
3746
|
switch (choice) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aris-mac-cleaner",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Premium macOS maintenance with organized menu and deep clean - Clean caches, free space, analyze disk, and optimize performance",
|
|
5
5
|
"author": "Salvador Reis",
|
|
6
6
|
"license": "MIT",
|