From f683dfc2cf6df79d03488386c9c83f7819df4ae5 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Fri, 23 Apr 2021 11:59:54 +1200 Subject: [PATCH] no version = latest version --- cli/commands/execute.js | 8 +++++++- cli/commands/ppman_commands/install.js | 4 ++-- cli/commands/ppman_commands/uninstall.js | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cli/commands/execute.js b/cli/commands/execute.js index 6adaf7e..2cd0595 100644 --- a/cli/commands/execute.js +++ b/cli/commands/execute.js @@ -3,11 +3,17 @@ const fs = require('fs'); const path = require('path'); const chalk = require('chalk'); -exports.command = ['execute [args..]'] +exports.command = ['execute [args..]'] exports.aliases = ['run'] exports.describe = 'Executes file with the specified runner' exports.builder = { + languageVersion: { + string: true, + desc: 'Set the version of the language to use', + alias: ['l'], + default: '*' + }, stdin: { boolean: true, desc: 'Read input from stdin and pass to executor', diff --git a/cli/commands/ppman_commands/install.js b/cli/commands/ppman_commands/install.js index 4211510..fedf5b8 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 '] +exports.command = ['install [language-version]'] exports.aliases = ['i'] exports.describe = 'Installs the named package' @@ -14,7 +14,7 @@ const msg_format = { exports.handler = async function({axios, language, languageVersion}){ try{ - const install = await axios.post(`/api/v1/packages/${language}/${languageVersion}`) + const install = await axios.post(`/api/v1/packages/${language}/${languageVersion || '*'}`) 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 dc5bd87..0e4ebf2 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 '] +exports.command = ['uninstall [language-version]'] exports.aliases = ['u'] exports.describe = 'Uninstalls the named package' @@ -14,7 +14,7 @@ const msg_format = { exports.handler = async function({axios, language, languageVersion}){ try{ - const uninstall = await axios.delete(`/api/v1/packages/${language}/${languageVersion}`) + const uninstall = await axios.delete(`/api/v1/packages/${language}/${languageVersion || '*'}`) console.log(msg_format.color(uninstall.data)); }catch({response}){