mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-23 21:46:27 +02:00
validate json instead of a json header, and lots of cleanup
This commit is contained in:
parent
0da1cd5867
commit
de449c6d56
15 changed files with 272 additions and 269 deletions
|
@ -1,22 +1,17 @@
|
|||
//const fetch = require('node-fetch');
|
||||
const chalk = require('chalk');
|
||||
|
||||
exports.command = ['list']
|
||||
exports.aliases = ['l']
|
||||
exports.describe = 'Lists all available packages'
|
||||
|
||||
exports.command = ['list'];
|
||||
exports.aliases = ['l'];
|
||||
exports.describe = 'Lists all available packages';
|
||||
|
||||
const msg_format = {
|
||||
'color': p => `${chalk[p.installed ? "green":"red"]("•")} ${p.language} ${p.language_version}`,
|
||||
'monochrome': p => `${p.language} ${p.language_version} ${p.installed ? "(INSTALLED)": ""}`,
|
||||
'json': JSON.stringify
|
||||
|
||||
}
|
||||
|
||||
exports.handler = async function({axios}){
|
||||
|
||||
const packages = await axios.get('/api/v1/packages');
|
||||
color: p => `${chalk[p.installed ? 'green':'red']('•')} ${p.language} ${p.language_version}`,
|
||||
monochrome: p => `${p.language} ${p.language_version} ${p.installed ? '(INSTALLED)': ''}`,
|
||||
json: JSON.stringify
|
||||
};
|
||||
|
||||
exports.handler = async ({ axios }) => {
|
||||
const packages = await axios.get('/api/v2/packages');
|
||||
|
||||
const pkg_msg = packages.data
|
||||
.map(msg_format.color)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue