From 93188099b7a5f34336b8083b5271044c92a36d39 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 8 May 2021 12:57:37 +1200 Subject: [PATCH] fix cli --- cli/commands/execute.js | 4 ++-- cli/commands/ppman_commands/install.js | 12 +++++++----- cli/commands/ppman_commands/uninstall.js | 11 ++++++----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cli/commands/execute.js b/cli/commands/execute.js index f511350..e273548 100644 --- a/cli/commands/execute.js +++ b/cli/commands/execute.js @@ -8,7 +8,7 @@ exports.aliases = ['run']; exports.describe = 'Executes file with the specified runner'; exports.builder = { - version: { + language_version: { string: true, desc: 'Set the version of the language to use', alias: ['l'], @@ -55,7 +55,7 @@ exports.handler = async (argv) => { const request = { language: argv.language, - version: argv['language-version'], + version: argv['language_version'], files: files, args: argv.args, stdin, diff --git a/cli/commands/ppman_commands/install.js b/cli/commands/ppman_commands/install.js index 4e48c20..5d9e92a 100644 --- a/cli/commands/ppman_commands/install.js +++ b/cli/commands/ppman_commands/install.js @@ -1,6 +1,6 @@ const chalk = require('chalk'); -exports.command = ['install [language-version]']; +exports.command = ['install [language_version]']; exports.aliases = ['i']; exports.describe = 'Installs the named package'; @@ -10,12 +10,14 @@ const msg_format = { json: JSON.stringify }; -exports.handler = async ({ axios, language, version }) => { +exports.handler = async ({ axios, language, language_version }) => { try { - const install = await axios.post(`/api/v2/packages`, { + const request = { language, - version: version || '*' - }); + version: language_version || '*' + }; + + const install = await axios.post(`/api/v2/packages`, request); console.log(msg_format.color(install.data)); } catch ({ response }) { diff --git a/cli/commands/ppman_commands/uninstall.js b/cli/commands/ppman_commands/uninstall.js index 1ea9161..c7cbc83 100644 --- a/cli/commands/ppman_commands/uninstall.js +++ b/cli/commands/ppman_commands/uninstall.js @@ -1,6 +1,6 @@ const chalk = require('chalk'); -exports.command = ['uninstall [language-version]']; +exports.command = ['uninstall [language_version]']; exports.aliases = ['u']; exports.describe = 'Uninstalls the named package'; @@ -10,12 +10,13 @@ const msg_format = { json: JSON.stringify }; -exports.handler = async ({ axios, language, version }) => { +exports.handler = async ({ axios, language, language_version }) => { try { - const install = await axios.delete(`/api/v2/packages`, { + const request = { language, - version: version || '*' - }); + version: language_version || '*' + }; + const uninstall = await axios.delete(`/api/v2/packages`, {data: request}); console.log(msg_format.color(uninstall.data)); } catch ({ response }) {