mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Use chalk instead of hardcoded ANSI codes
Improves the readability of the source code and prevents the raw ANSI codes from appearing in the log, if ran as a systemd service.
This commit is contained in:
@@ -16,6 +16,7 @@ var BridgeSetupManager = require("./bridgeSetupManager").BridgeSetupManager;
|
|||||||
var log = require("./logger")._system;
|
var log = require("./logger")._system;
|
||||||
var Logger = require('./logger').Logger;
|
var Logger = require('./logger').Logger;
|
||||||
var mac = require("./util/mac");
|
var mac = require("./util/mac");
|
||||||
|
var chalk = require('chalk');
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@@ -578,9 +579,9 @@ Server.prototype._handleNewConfig = function(type, name, replace, config) {
|
|||||||
// Returns the setup code in a scannable format.
|
// Returns the setup code in a scannable format.
|
||||||
Server.prototype._printPin = function(pin) {
|
Server.prototype._printPin = function(pin) {
|
||||||
console.log("Scan this code with your HomeKit App on your iOS device to pair with Homebridge:");
|
console.log("Scan this code with your HomeKit App on your iOS device to pair with Homebridge:");
|
||||||
console.log("\x1b[30;47m%s\x1b[0m", " ");
|
console.log(chalk.black.bgWhite(" "));
|
||||||
console.log("\x1b[30;47m%s\x1b[0m", " ┌────────────┐ ");
|
console.log(chalk.black.bgWhite(" ┌────────────┐ "));
|
||||||
console.log("\x1b[30;47m%s\x1b[0m", " │ " + pin + " │ ");
|
console.log(chalk.black.bgWhite(" │ " + pin + " │ "));
|
||||||
console.log("\x1b[30;47m%s\x1b[0m", " └────────────┘ ");
|
console.log(chalk.black.bgWhite(" └────────────┘ "));
|
||||||
console.log("\x1b[30;47m%s\x1b[0m", " ");
|
console.log(chalk.black.bgWhite(" "));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user