-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
25 lines (21 loc) · 810 Bytes
/
utils.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
module.exports = {
isCompactProcess () {
return process.argv[2] === 'compacta';
},
isUncompactProcess () {
return process.argv[2] === 'descompacta'
},
inputVerifications() {
if (process.argv.length <= 4) {
console.error('Use Example: node index.js (compacta | descompacta) (./folderToCompact | ./zipFileToUncompact) (./nameOfFile.zip | ./nameOfFolderDestiny)');
process.exit(-1);
}
if(this.isCompactProcess()) {
const typeFileToGenerate = process.argv[4].split('.')[1];
if (typeFileToGenerate !== ('zip' || 'tar')) {
console.error('Only .zip or .tar files are accepted to be generated by this program.');
process.exit(-1);
}
}
}
}