Skip to content

Commit

Permalink
Merge pull request #30 from biowasm/feature/custom-args-for-main
Browse files Browse the repository at this point in the history
Modify exec() so we can pass along custom arguments
  • Loading branch information
robertaboukhalil authored Aug 26, 2021
2 parents a3aaf6f + 3faa2c4 commit 0f5e9d2
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 0f5e9d2

Please sign in to comment.