@aminya/dotenv-vault
Version:
A secrets manager for .env files – from the same people that pioneered dotenv.
35 lines (34 loc) • 1.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatusService = void 0;
const tslib_1 = require("tslib");
const chalk_1 = tslib_1.__importDefault(require("chalk"));
const core_1 = require("@oclif/core");
const log_service_1 = require("../services/log-service");
const abort_service_1 = require("../services/abort-service");
class StatusService {
constructor(attrs = {}) {
this.cmd = attrs.cmd;
this.yes = attrs.yes;
this.log = new log_service_1.LogService({ cmd: attrs.cmd });
this.abort = new abort_service_1.AbortService({ cmd: attrs.cmd });
}
async run() {
if (!this.yes) {
this.log.local(`Status URL: ${this.statusUrl}`);
const answer = await core_1.CliUx.ux.prompt(`${chalk_1.default.dim(this.log.pretextLocal)}Press ${chalk_1.default.green('y')} (or any key) to open up the browser to view the dotenv-vault status page or ${chalk_1.default.yellow('q')} to exit`);
if (answer === 'q' || answer === 'Q') {
this.abort.quit();
}
}
core_1.CliUx.ux.action.start(`${chalk_1.default.dim(this.log.pretextLocal)}Opening status page`);
await core_1.CliUx.ux.wait(1000);
core_1.CliUx.ux.action.stop();
this.log.local(`Opening browser to ${this.statusUrl}`);
core_1.CliUx.ux.open(this.statusUrl).catch(_ => { });
}
get statusUrl() {
return 'https://status.dotenv.org';
}
}
exports.StatusService = StatusService;