Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
To talk with Tiago, if necessary, we'll do it this way
  • Loading branch information
elchananarb committed Aug 6, 2024
1 parent 21a355e commit 55d912a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/main/wrapper/ExecutionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import CxChat from "../chat/CxChat";
import CxMask from "../mask/CxMask";
import CxVorpal from "../vorpal/CxVorpal";

let skipNext = false;

function isJsonString(s: string) {
try {
Expand All @@ -35,14 +36,26 @@ function isJsonString(s: string) {
return true;
}

function transformation(commands: string[]):string[] {
const result:string[] = commands.map(transform);
function transformation(commands: string[]): string[] {
skipNext = false; // Reset the flag before processing
const result: string[] = commands.map(transform);
return result;
}

function transform(n:string) {
// If the flag is set, return the current string as-is and reset the flag
if (skipNext) {
skipNext = false;
return n;
}
// If the current string is "--file-source", set the flag and return it as-is
if (n === "--file-source") {
skipNext = true;
return n;
}

let r = "";
if(n) r = n.replace(/["]/g, "").replace("/[, ]/g",",");
if(n) r = n.replace(/["']/g, "").replace("/[, ]/g",",");
return r;
}

Expand Down

0 comments on commit 55d912a

Please sign in to comment.