mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 21:02:38 +00:00
Provider logging
This commit is contained in:
22
lib/cli.js
22
lib/cli.js
@@ -83,6 +83,9 @@ class CliProviderSetup {
|
||||
prompt.start();
|
||||
prompt.get(this.buildPromptSchema(), (err, result) => {
|
||||
|
||||
// add a linebreak after our last prompt
|
||||
console.log('');
|
||||
|
||||
// apply configuration values entered by the user
|
||||
for (let key:string in result) {
|
||||
let value:object = result[key];
|
||||
@@ -103,7 +106,24 @@ class CliProviderSetup {
|
||||
}
|
||||
|
||||
validateProviderConfig() {
|
||||
this.providerModule.validateConfig();
|
||||
|
||||
let currentlyInsideValidateConfigCall = false;
|
||||
|
||||
// we allow for the provider's validateConfig to call our callback immediately/synchronously
|
||||
// from inside validateConfig() itself.
|
||||
let callback = (err) => {
|
||||
|
||||
if (!err) {
|
||||
log.info(`Setup complete.`);
|
||||
}
|
||||
else {
|
||||
log.error(`Setup failed: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
currentlyInsideValidateConfigCall = true;
|
||||
this.providerModule.validateConfig(callback);
|
||||
currentlyInsideValidateConfigCall = false;
|
||||
}
|
||||
|
||||
// builds a "schema" obejct for the prompt lib based on the provider's config spec
|
||||
|
||||
Reference in New Issue
Block a user