diff --git a/cli/commands/execute.js b/cli/commands/execute.js index 4fbcbc5..11afaa2 100644 --- a/cli/commands/execute.js +++ b/cli/commands/execute.js @@ -50,16 +50,16 @@ exports.handler = async function(argv){ })) || ""; - const response = await api.run_job( - argv.language, - argv['language-version'], - files, - argv.file, - argv.args, + const response = await api.run_job({ + language: argv.language, + version: argv['language-version'], + files: files, + main: argv.file, + arsg: argv.args, stdin, - argv.ct, - argv.rt - ) + compile_timeout: argv.ct, + run_timeout: argv.rt + }) function step(name, ctx){ console.log(chalk.bold(`== ${name} ==`)) diff --git a/cli/commands/ppman_commands/install.js b/cli/commands/ppman_commands/install.js index 4c4b10a..1cab867 100644 --- a/cli/commands/ppman_commands/install.js +++ b/cli/commands/ppman_commands/install.js @@ -17,11 +17,13 @@ exports.handler = async function(argv){ const api = new PistonEngine(argv['piston-url']); const repos = await api.list_repos(); + const repos_obj = await Promise.all(repos.repos.map(({slug}) => api.get_repo(slug))); + const repo_pkgs = await Promise.all(repos_obj.map( async repo => ({ repo: repo, - packages: await repo.list_packages().catch(x=>[]) + packages: await repo.list_packages().catch(_=>[]) }) )) diff --git a/cli/commands/ppman_commands/list.js b/cli/commands/ppman_commands/list.js index 162d286..6dd4bed 100644 --- a/cli/commands/ppman_commands/list.js +++ b/cli/commands/ppman_commands/list.js @@ -17,11 +17,14 @@ exports.handler = async function(argv){ const api = new PistonEngine(argv['piston-url']); const repos = await api.list_repos(); + const repos_obj = await Promise.all(repos.repos.map(({slug}) => api.get_repo(slug))); - const packages = await repos_obj.reduce(async (a, c) => [ - ...await a, - ...await c.list_packages().catch(x=>{console.log(x); return []}) - ], []); + + const packages = await repos_obj.reduce(async (accumulator, repo) => [ + ...await accumulator, + ...await repo.list_packages() + .catch(x=>{console.log(x); return []}) + ], []); // Loops over repos, listing packages and flattening them into a single array const pkg_msg = packages .map(msg_format.color)