Major update: Add Environment variables support
This commit is contained in:
@@ -111,6 +111,14 @@ function sync({ options, filePath, files }) {
|
||||
const dstFl = destFiles[j];
|
||||
if (typeof dstFl == "string") {
|
||||
if (!fs.existsSync(dstFl)) continue;
|
||||
|
||||
if (filePath === dstFl) {
|
||||
console.log(
|
||||
`You can't sync the same paths. Please check your configuration and resolve duplicate paths`
|
||||
);
|
||||
process.exit(6);
|
||||
}
|
||||
|
||||
cmdArray.push(filePath, dstFl);
|
||||
const cmd = cmdArray.join(" ");
|
||||
execSync(cmd, {
|
||||
@@ -119,6 +127,13 @@ function sync({ options, filePath, files }) {
|
||||
} else if (dstFl.path) {
|
||||
if (!dstFl.host && !fs.existsSync(dstFl.path)) continue;
|
||||
|
||||
if (filePath === dstFl.path) {
|
||||
console.log(
|
||||
`You can't sync the same paths. Please check your configuration and resolve duplicate paths`
|
||||
);
|
||||
process.exit(6);
|
||||
}
|
||||
|
||||
if (dstFl.host && dstFl.ssh_key && dstFl.user) {
|
||||
cmdArray.push("-e", `'ssh -i ${dstFl.ssh_key}'`);
|
||||
cmdArray.push(
|
||||
|
||||
@@ -120,6 +120,14 @@ function sync({ options, dirs, dirPath, init }) {
|
||||
const dstDr = dstDirs[j];
|
||||
if (typeof dstDr == "string") {
|
||||
if (!fs.existsSync(dstDr)) continue;
|
||||
|
||||
if (dirPath === dstDr) {
|
||||
console.log(
|
||||
`You can't sync the same paths. Please check your configuration and resolve duplicate paths`
|
||||
);
|
||||
process.exit(6);
|
||||
}
|
||||
|
||||
cmdArray.push(
|
||||
path.normalize(dirPath) + "/",
|
||||
path.normalize(dstDr) + "/"
|
||||
@@ -131,6 +139,13 @@ function sync({ options, dirs, dirPath, init }) {
|
||||
} else if (dstDr.path) {
|
||||
if (!dstDr.host && !fs.existsSync(dstDr.path)) continue;
|
||||
|
||||
if (dirPath === dstDr.path) {
|
||||
console.log(
|
||||
`You can't sync the same paths. Please check your configuration and resolve duplicate paths`
|
||||
);
|
||||
process.exit(6);
|
||||
}
|
||||
|
||||
if (dstDr.host && dstDr.ssh_key && dstDr.user) {
|
||||
cmdArray.push("-e", `'ssh -i ${dstDr.ssh_key}'`);
|
||||
cmdArray.push(
|
||||
|
||||
Reference in New Issue
Block a user