2021-03-13 04:44:33 +01:00
|
|
|
//const fetch = require('node-fetch');
|
2021-02-27 07:30:11 +01:00
|
|
|
const chalk = require('chalk');
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-03-13 04:44:33 +01:00
|
|
|
exports.handler = async function({axios}){
|
2021-03-05 07:40:47 +01:00
|
|
|
|
2021-03-13 04:44:33 +01:00
|
|
|
const packages = await axios.get('/packages');
|
2021-03-05 07:40:47 +01:00
|
|
|
|
2021-03-13 04:44:33 +01:00
|
|
|
|
|
|
|
const pkg_msg = packages.data.data.packages
|
2021-02-27 07:30:11 +01:00
|
|
|
.map(msg_format.color)
|
|
|
|
.join('\n');
|
|
|
|
|
|
|
|
console.log(pkg_msg);
|
|
|
|
}
|