This commit is contained in:
Thomas Hobson 2021-05-08 12:57:37 +12:00
parent 543cb11e69
commit 93188099b7
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
3 changed files with 15 additions and 12 deletions

View File

@ -8,7 +8,7 @@ exports.aliases = ['run'];
exports.describe = 'Executes file with the specified runner'; exports.describe = 'Executes file with the specified runner';
exports.builder = { exports.builder = {
version: { language_version: {
string: true, string: true,
desc: 'Set the version of the language to use', desc: 'Set the version of the language to use',
alias: ['l'], alias: ['l'],
@ -55,7 +55,7 @@ exports.handler = async (argv) => {
const request = { const request = {
language: argv.language, language: argv.language,
version: argv['language-version'], version: argv['language_version'],
files: files, files: files,
args: argv.args, args: argv.args,
stdin, stdin,

View File

@ -1,6 +1,6 @@
const chalk = require('chalk'); const chalk = require('chalk');
exports.command = ['install <language> [language-version]']; exports.command = ['install <language> [language_version]'];
exports.aliases = ['i']; exports.aliases = ['i'];
exports.describe = 'Installs the named package'; exports.describe = 'Installs the named package';
@ -10,12 +10,14 @@ const msg_format = {
json: JSON.stringify json: JSON.stringify
}; };
exports.handler = async ({ axios, language, version }) => { exports.handler = async ({ axios, language, language_version }) => {
try { try {
const install = await axios.post(`/api/v2/packages`, { const request = {
language, language,
version: version || '*' version: language_version || '*'
}); };
const install = await axios.post(`/api/v2/packages`, request);
console.log(msg_format.color(install.data)); console.log(msg_format.color(install.data));
} catch ({ response }) { } catch ({ response }) {

View File

@ -1,6 +1,6 @@
const chalk = require('chalk'); const chalk = require('chalk');
exports.command = ['uninstall <language> [language-version]']; exports.command = ['uninstall <language> [language_version]'];
exports.aliases = ['u']; exports.aliases = ['u'];
exports.describe = 'Uninstalls the named package'; exports.describe = 'Uninstalls the named package';
@ -10,12 +10,13 @@ const msg_format = {
json: JSON.stringify json: JSON.stringify
}; };
exports.handler = async ({ axios, language, version }) => { exports.handler = async ({ axios, language, language_version }) => {
try { try {
const install = await axios.delete(`/api/v2/packages`, { const request = {
language, language,
version: version || '*' version: language_version || '*'
}); };
const uninstall = await axios.delete(`/api/v2/packages`, {data: request});
console.log(msg_format.color(uninstall.data)); console.log(msg_format.color(uninstall.data));
} catch ({ response }) { } catch ({ response }) {