-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
39 lines (29 loc) · 816 Bytes
/
app.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
#!/usr/bin/env node
const fs = require('fs');
const path = require('path')
const helpObj = require("./commands/help");
const organizeObj = require("./commands/organize");
const treeObj = require("./commands/tree");
const types = require("./utility/extension")
// node app.js tree path
// node app.js organize path
// node app.js help
// Driver code
const inputArr = process.argv.slice(2);
// console.log(inputArr);
// inputArr[0] -> command
// inputArr[1] -> Directory path
const command = inputArr[0];
switch (command) {
case 'tree':
treeObj.treeKey(inputArr[1]);
break;
case 'organize':
organizeObj.organizeKey(inputArr[1])
break;
case 'help':
helpObj.helpKey();
break;
default:
console.log('Please enter valid command 🙄🙄');
}