auto-organize 1.1.0 → 1.2.1
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/package.json +3 -2
- package/src/cli/spinner.js +8 -0
- package/src/index.js +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-organize",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "CLI tool to organize files in a directory based on their file types.",
|
|
5
5
|
"main": "./bin/auto-organize.js",
|
|
6
6
|
"bin": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"node": ">=18"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"chalk": "^5.6.2"
|
|
48
|
+
"chalk": "^5.6.2",
|
|
49
|
+
"ora": "^9.1.0"
|
|
49
50
|
}
|
|
50
51
|
}
|
package/src/index.js
CHANGED
|
@@ -3,8 +3,11 @@ import { renderFoldersSummary } from './cli/renderSummary.js';
|
|
|
3
3
|
import { parseArgs } from './utils/parseArgs.js';
|
|
4
4
|
import { getAvailableTypes } from './rules/byType.js';
|
|
5
5
|
import { cliActions } from './cli/cliActions.js';
|
|
6
|
+
import { startSpinner } from './cli/spinner.js';
|
|
6
7
|
|
|
7
8
|
function main() {
|
|
9
|
+
let spinner;
|
|
10
|
+
|
|
8
11
|
try {
|
|
9
12
|
const cliArguments = process.argv.slice(2);
|
|
10
13
|
const cliFlags = parseArgs(cliArguments);
|
|
@@ -17,13 +20,27 @@ function main() {
|
|
|
17
20
|
process.exit(cliResult.code);
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
spinner = startSpinner('Organizing files...');
|
|
20
24
|
const summary = organizeDirectory(currentDir, cliFlags);
|
|
21
25
|
|
|
22
|
-
if(!summary)
|
|
26
|
+
if(!summary){
|
|
27
|
+
spinner.stop();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
23
30
|
|
|
24
31
|
renderFoldersSummary(summary);
|
|
25
32
|
|
|
33
|
+
if(summary.previewMode){
|
|
34
|
+
console.log("");
|
|
35
|
+
spinner.succeed('Preview generated successfully!');
|
|
36
|
+
}else{
|
|
37
|
+
spinner.succeed('Files organized successfully!');
|
|
38
|
+
}
|
|
39
|
+
|
|
26
40
|
} catch (error) {
|
|
41
|
+
if(spinner){
|
|
42
|
+
spinner.fail('Error organizing files');
|
|
43
|
+
}
|
|
27
44
|
console.error(`\nError: ${error.message}`);
|
|
28
45
|
process.exit(1);
|
|
29
46
|
}
|