-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
50 lines (48 loc) · 1.01 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env node
// Mkaing the file global
let inputArr = process.argv.slice(2);
let fs = require("fs");
let path = require("path");
let helpObj = require("./commands/help");
let treeObj = require("./commands/tree");
let organizeObj = require("./commands/organize");
// console.log(inputArr);
// node main.js tree "directoryPath"
// node main.js organize "directoryPath"
// node main.js help
let command = inputArr[0];
console.log(command);
let types = {
media: ["mp4", "mkv"],
archives: ["zip", "7z", "rar", "tar", "gz", "ar", "iso", "xz"],
documents: [
"docx",
"doc",
"pdf",
"xlsx",
"xls",
"odt",
"ods",
"odp",
"odg",
"odf",
"txt",
"ps",
"tex",
],
images: ["jpg", "jpeg", "png"],
};
switch (command) {
case "tree":
treeObj.treeKey(inputArr[1]);
break;
case "organize":
organizeObj.organizeKey(inputArr[1], types);
break;
case "help":
helpObj.helpKey();
break;
default:
console.log("Please 🙏 Input Right command");
break;
}