Compare commits

..

2 Commits

Author SHA1 Message Date
167b4d29df 3.0.11 2020-04-13 21:53:18 +00:00
02fec216db fix(core): more consistent handling of process.enc.CLI_CALL 2020-04-13 21:53:18 +00:00
3 changed files with 10 additions and 14 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartcli",
"version": "3.0.10",
"version": "3.0.11",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "@pushrocks/smartcli",
"private": false,
"version": "3.0.10",
"version": "3.0.11",
"description": "easy observable cli tasks",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",

View File

@ -27,7 +27,7 @@ export class Smartcli {
commands;
questions;
version: string;
private onlyOnProcessEnvCliCall = false;
private checkForEnvCliCall = true;
/**
* map of all Trigger/Observable objects to keep track
@ -46,8 +46,8 @@ export class Smartcli {
/**
* halts any execution of commands if (process.env.CLI_CALL === false)
*/
onlyTriggerOnProcessEnvCliCall() {
this.onlyOnProcessEnvCliCall = true;
disableEnvCliCall() {
this.checkForEnvCliCall = false;
}
/**
@ -144,15 +144,7 @@ export class Smartcli {
(this.argv._.length === 1 && this.argv._[0].startsWith('test/'))) &&
!this.argv.v
) {
if (this.onlyOnProcessEnvCliCall) {
if (process.env.CLI_CALL === 'true') {
this.trigger('standardTask');
} else {
return;
}
} else {
this.trigger('standardTask');
}
}
});
return standardSubject;
@ -162,6 +154,10 @@ export class Smartcli {
* start the process of evaluating commands
*/
startParse(): void {
if (!process.env.CLI_CALL && this.checkForEnvCliCall) {
console.log(`note: @pushrocks/smartcli: You called .startParse() on a SmartCli instance. However process.env.CLI_CALL being absent prevented parsing.`);
return;
}
this.argv = this.argv.argv;
this.parseStarted.resolve();
return;