mirror of
https://github.com/SileNce5k/jscripts.git
synced 2025-04-19 19:16:18 +02:00
Add missing semicolons
This commit is contained in:
parent
78a98e70cc
commit
7a7dc93e4e
1 changed files with 6 additions and 6 deletions
|
@ -27,19 +27,19 @@ function printHelp(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileNotFound(pathToTextFile) {
|
function fileNotFound(pathToTextFile) {
|
||||||
console.log(`FILE NOT FOUND: ${pathToTextFile}\n`)
|
console.log(`FILE NOT FOUND: ${pathToTextFile}\n`);
|
||||||
process.exit(404)
|
process.exit(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanFile(pathToTextFile) {
|
function cleanFile(pathToTextFile) {
|
||||||
let file = fs.readFileSync(pathToTextFile).toString();
|
let file = fs.readFileSync(pathToTextFile).toString();
|
||||||
const regex = /(\[)(.*)(\])/gm
|
const regex = /(\[)(.*)(\])/gm;
|
||||||
file = file.replace(regex, "");
|
file = file.replace(regex, "");
|
||||||
let newPath = `CLEANED_${path.basename(pathToTextFile)}`
|
let newPath = `CLEANED_${path.basename(pathToTextFile)}`;
|
||||||
fs.writeFileSync(newPath, file);
|
fs.writeFileSync(newPath, file);
|
||||||
console.log(`\nWrote new file to ${newPath}`)
|
console.log(`\nWrote new file to ${newPath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let pathToTextFile = argHandler(process.argv);
|
let pathToTextFile = argHandler(process.argv);
|
||||||
|
|
||||||
fs.existsSync(pathToTextFile) ? cleanFile(pathToTextFile) : fileNotFound(pathToTextFile)
|
fs.existsSync(pathToTextFile) ? cleanFile(pathToTextFile) : fileNotFound(pathToTextFile);
|
Loading…
Add table
Reference in a new issue