aboutsummaryrefslogtreecommitdiffstats
path: root/cli.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli.js')
-rwxr-xr-xcli.js39
1 files changed, 33 insertions, 6 deletions
diff --git a/cli.js b/cli.js
index 04fca98..348c092 100755
--- a/cli.js
+++ b/cli.js
@@ -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();
});