UI for Zipcoin Blue

telemetry.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const tslib_1 = require("tslib");
  4. const chalk_1 = require("chalk");
  5. const lib_1 = require("@ionic/cli-framework/lib");
  6. const command_1 = require("@ionic/cli-utils/lib/command");
  7. let TelemetryCommand = class TelemetryCommand extends command_1.Command {
  8. preRun(inputs, options) {
  9. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  10. this.env.log.warn(`${chalk_1.default.green('ionic telemetry')} is deprecated. Please use ${chalk_1.default.green('ionic config')} directly. Examples:\n` +
  11. ` ${chalk_1.default.green('ionic config get -g telemetry')}\n` +
  12. ` ${chalk_1.default.green('ionic config set -g telemetry true')}\n` +
  13. ` ${chalk_1.default.green('ionic config set -g telemetry false')}`);
  14. });
  15. }
  16. run(inputs, options) {
  17. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  18. const config = yield this.env.config.load();
  19. const [status] = inputs;
  20. const enableTelemetry = config.telemetry;
  21. if (typeof status === 'string') {
  22. config.telemetry = status.toLowerCase() === 'on';
  23. }
  24. if (typeof status === 'string' || enableTelemetry !== config.telemetry) {
  25. this.env.log.ok(`Telemetry: ${chalk_1.default.bold(config.telemetry ? 'ON' : 'OFF')}`);
  26. }
  27. else {
  28. this.env.log.msg(`Telemetry: ${chalk_1.default.bold(config.telemetry ? 'ON' : 'OFF')}`);
  29. }
  30. if (config.telemetry) {
  31. this.env.log.msg('Thank you for making the CLI better! ❤️');
  32. }
  33. });
  34. }
  35. };
  36. TelemetryCommand = tslib_1.__decorate([
  37. command_1.CommandMetadata({
  38. name: 'telemetry',
  39. type: 'global',
  40. description: 'Opt in and out of telemetry',
  41. deprecated: true,
  42. inputs: [
  43. {
  44. name: 'status',
  45. description: `${chalk_1.default.green('on')} or ${chalk_1.default.green('off')}`,
  46. validators: [lib_1.contains(['on', 'off'], { caseSensitive: false })],
  47. required: false,
  48. }
  49. ],
  50. })
  51. ], TelemetryCommand);
  52. exports.TelemetryCommand = TelemetryCommand;