-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
83 lines (65 loc) · 2.11 KB
/
options.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const package = require('./package');
const { errorResponse, successResponse } = require('./helper/customResponse');
const { WELCOME_SCREEN } = require('./helper/constant');
const { createFile } = require('./features/CreateFile');
const { createFolder } = require('./features/CreateFolder');
const { renameFile } = require('./features/RenameFile');
const { deleteFile } = require('./features/DeleteFile');
const { FileExists } = require('./features/FileExists');
const { readFile } = require('./features//ReadFile');
const { readDirectory } = require('./features/ReadDirectory');
const { createZip } = require('./features/CreateZip');
const { createLocalServer } = require('./features/createLocalServer');
const { createQR } = require('./features/CreateQRCode');
module.exports = { options }
/**
* @desc Checks for options
* @param {*} arguments // Accepts string
*/
function options(arguments) {
const command = arguments[2];
switch(command) {
case '-f':
createFile(arguments[3]);
break;
case '-dir':
createFolder(arguments[3]);
break;
case '-rn':
renameFile(arguments[3], arguments[4]);
break;
case '-rm':
deleteFile(arguments[3]);
break;
case '-e':
FileExists(arguments[3]);
break;
case '-rf':
readFile(arguments[3]);
break;
case '-rd':
readDirectory();
break;
case '-zip':
createZip(arguments[3]);
break;
case '-serve':
createLocalServer(arguments);
break;
case '-qr':
createQR(arguments[3]);
break;
case '-v':
successResponse(`> ${package.version}`);
break;
case '--version':
successResponse(`> ${package.version}`);
break;
case '--help':
WELCOME_SCREEN();
break;
default:
errorResponse(`command does not exist`);
break;
}
}