Skip to content

Commit

Permalink
Modify exec() so we can pass along custom arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
robertaboukhalil committed Aug 26, 2021
1 parent a3aaf6f commit 3faa2c4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,18 @@ const aioli = {
// =========================================================================
// Execute a command
// =========================================================================
async exec(command)
async exec(command, args=null)
{
// Input validation
aioli._log(`Executing: %c${command}%c`, "color:darkblue; font-weight:bold");
aioli._log(`Executing %c${command}%c args=${args}`, "color:darkblue; font-weight:bold", "");
if(!command)
throw "Expecting a command";
// Extract tool name and arguments
const args = command.split(" ");
const toolName = args.shift();
let toolName = command;
if(args == null) {
args = command.split(" ");
toolName = args.shift();
}

// Does it match a program we've already initialized?
const tools = aioli.tools.filter(d => d.program == toolName);
Expand Down

0 comments on commit 3faa2c4

Please sign in to comment.