fix(core): more consistent handling of process.enc.CLI_CALL
This commit is contained in:
parent
4e9d2f3e8c
commit
02fec216db
@ -27,7 +27,7 @@ export class Smartcli {
|
|||||||
commands;
|
commands;
|
||||||
questions;
|
questions;
|
||||||
version: string;
|
version: string;
|
||||||
private onlyOnProcessEnvCliCall = false;
|
private checkForEnvCliCall = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* map of all Trigger/Observable objects to keep track
|
* 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)
|
* halts any execution of commands if (process.env.CLI_CALL === false)
|
||||||
*/
|
*/
|
||||||
onlyTriggerOnProcessEnvCliCall() {
|
disableEnvCliCall() {
|
||||||
this.onlyOnProcessEnvCliCall = true;
|
this.checkForEnvCliCall = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,15 +144,7 @@ export class Smartcli {
|
|||||||
(this.argv._.length === 1 && this.argv._[0].startsWith('test/'))) &&
|
(this.argv._.length === 1 && this.argv._[0].startsWith('test/'))) &&
|
||||||
!this.argv.v
|
!this.argv.v
|
||||||
) {
|
) {
|
||||||
if (this.onlyOnProcessEnvCliCall) {
|
|
||||||
if (process.env.CLI_CALL === 'true') {
|
|
||||||
this.trigger('standardTask');
|
this.trigger('standardTask');
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.trigger('standardTask');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return standardSubject;
|
return standardSubject;
|
||||||
@ -162,6 +154,10 @@ export class Smartcli {
|
|||||||
* start the process of evaluating commands
|
* start the process of evaluating commands
|
||||||
*/
|
*/
|
||||||
startParse(): void {
|
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.argv = this.argv.argv;
|
||||||
this.parseStarted.resolve();
|
this.parseStarted.resolve();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user