bilderhic
Advanced tools
Comparing version 1.1.14 to 1.1.15
{ | ||
"name": "bilderhic", | ||
"version": " 1.1.14", | ||
"version": " 1.1.15", | ||
"description": "Bilderhic (bhic) is a smart and simple command tool for automatization.", | ||
@@ -5,0 +5,0 @@ "preferGlobal": true, |
@@ -110,3 +110,3 @@ <img src="https://lucianorasente.com/public_img/bhic.png" style="max-width:100px;width:100%;"> | ||
```bash | ||
copy <from> <to> [-i or --ignore <file or folder>] [-q or --quiet] | ||
copy <from> <to> [-i or --ignore <file or folder>] [-q or --quiet] [-e or --ignore-errors] | ||
``` | ||
@@ -113,0 +113,0 @@ |
@@ -20,2 +20,3 @@ /* eslint-disable no-restricted-syntax */ | ||
let quiet = false; | ||
let ignoreErrors = false; | ||
@@ -30,2 +31,5 @@ for (let i = 0; i < args.length; i++) { | ||
} | ||
else if (arg === "-e" || arg === "--ignore-errors") { | ||
ignoreErrors = true; | ||
} | ||
else if (!file1) { | ||
@@ -51,20 +55,28 @@ file1 = this.parsePath(arg); | ||
fse.copySync(file1, file2, { | ||
filter: (src, dest) => { | ||
if (ignores.length > 0) { | ||
for (const ignore of ignores) { | ||
if (src === ignore || src.endsWith(`/${ignore}`) || src.endsWith(`\\${ignore}`)) { | ||
return false; | ||
try { | ||
fse.copySync(file1, file2, { | ||
filter: (src, dest) => { | ||
if (ignores.length > 0) { | ||
for (const ignore of ignores) { | ||
if (src === ignore || src.endsWith(`/${ignore}`) || src.endsWith(`\\${ignore}`)) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
if (!quiet) { | ||
self.info(src); | ||
self.info(` => ${dest}`); | ||
} | ||
if (!quiet) { | ||
self.info(src); | ||
self.info(` => ${dest}`); | ||
} | ||
return true; | ||
}, | ||
}); | ||
return true; | ||
}, | ||
}); | ||
} | ||
catch (err) { | ||
this.debugError(err); | ||
if (!ignoreErrors) { | ||
throw err; | ||
} | ||
} | ||
@@ -71,0 +83,0 @@ return this.codes.success; |
@@ -37,2 +37,7 @@ const path = require("path"); | ||
it("should NOT fail if input file doesn't exists when ignore errors is activated", async () => { | ||
const result = await cmd.run(["aqowpej2", "dstination", "--ignore-errors"]); | ||
expect(result).to.be.equals(cmd.codes.success); | ||
}); | ||
it("should fail if input file doesn't exists", async () => { | ||
@@ -39,0 +44,0 @@ let error = null; |
143804
3701