mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-23 21:46:27 +02:00
cli: new api-client version
This commit is contained in:
parent
f9640d6166
commit
fe2e2f4e30
2 changed files with 7 additions and 24 deletions
|
@ -15,17 +15,10 @@ const msg_format = {
|
|||
|
||||
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 api.list_packages();
|
||||
|
||||
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)
|
||||
.join('\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue