diff options
Diffstat (limited to 'cli.js')
| -rwxr-xr-x | cli.js | 39 |
1 files changed, 33 insertions, 6 deletions
@@ -236,8 +236,8 @@ vorpal } if (!args.key || !args.value) { - this.log('Please provide both "key" and "value" arguments.'); - return callback(); + this.log('Please provide both "key" and "value" arguments.'); + return callback(); } try { @@ -248,7 +248,7 @@ vorpal this.log(chalk.green(`Secret "${args.key}" set successfully.`)); } catch (err) { this.log(chalk.red(`Failed to set secret ${args.key}!`)); - this.log(chalk.red(String(err))); + this.log(chalk.red(String(err))); } callback(); }); @@ -264,8 +264,8 @@ vorpal } if (!args.key) { - this.log('Please provide the "key" argument.'); - return callback(); + this.log('Please provide the "key" argument.'); + return callback(); } try { @@ -273,7 +273,34 @@ vorpal this.log(chalk.green(`Secret "${args.key}" removed successfully.`)); } catch (err) { this.log(chalk.red(`Failed to remove secret ${args.key}!`)); - this.log(chalk.red(String(err))); + this.log(chalk.red(String(err))); + } + callback(); + }); + +vorpal + .command('package install <package>', `Install an NPM package on the host.`) + .action(async function (args, callback) { + try { + await checkConnection(mongoURL, this); + } catch (err) { + showMongoNotSetError(vorpal); + return callback(); + } + + if (!args.package) { + this.log('Please provide the "package" argument.'); + return callback(); + } + + try { + await models.packages.insert({ + name: args.package + }); + this.log(chalk.green(`Package "${args.package}" added successfully to list of packages to install.`)); + } catch (err) { + this.log(chalk.red(`Failed to add package ${args.package} to list of packages to install!`)); + this.log(chalk.red(String(err))); } callback(); }); |
