mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-21 04:26:28 +02:00
Uninstallation (#211)
This commit is contained in:
parent
a2de8dea0c
commit
81cdc766b6
4 changed files with 77 additions and 5 deletions
23
cli/commands/ppman_commands/uninstall.js
Normal file
23
cli/commands/ppman_commands/uninstall.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const chalk = require('chalk');
|
||||
|
||||
exports.command = ['uninstall <language> <language-version>']
|
||||
exports.aliases = ['u']
|
||||
exports.describe = 'Installs the named package'
|
||||
|
||||
|
||||
const msg_format = {
|
||||
'color': p => `${p.language ? chalk.green.bold('✓') : chalk.red.bold('❌')} Uninstallation ${p.language ? "succeeded" : "failed: " + p.message}`,
|
||||
'monochrome': p => `Uninstallation ${p.language ? "succeeded" : "failed: " + p.message}`,
|
||||
'json': JSON.stringify
|
||||
|
||||
}
|
||||
|
||||
exports.handler = async function({axios, language, languageVersion}){
|
||||
try{
|
||||
const install = await axios.delete(`/packages/${language}/${languageVersion}`)
|
||||
|
||||
console.log(msg_format.color(install.data));
|
||||
}catch({response}){
|
||||
console.error(response.data.message)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue