GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.2 KiB

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const colorette_1 = require("colorette");
  5. const command_1 = require("../command");
  6. const error_1 = require("../error");
  7. const experiments = require("../experiments");
  8. const logger_1 = require("../logger");
  9. const utils_1 = require("../utils");
  10. exports.command = new command_1.Command("experiments:disable <experiment>")
  11. .description("disable an experiment on this machine")
  12. .action((experiment) => {
  13. if (experiments.isValidExperiment(experiment)) {
  14. experiments.setEnabled(experiment, false);
  15. experiments.flushToDisk();
  16. logger_1.logger.info(`Disabled experiment ${(0, colorette_1.bold)(experiment)}`);
  17. return;
  18. }
  19. let message = `Cannot find experiment ${(0, colorette_1.bold)(experiment)}`;
  20. const potentials = experiments.experimentNameAutocorrect(experiment);
  21. if (potentials.length === 1) {
  22. message = `${message}\nDid you mean ${potentials[0]}?`;
  23. }
  24. else if (potentials.length) {
  25. message = `${message}\nDid you mean ${potentials.slice(0, -1).join(",")} or ${(0, utils_1.last)(potentials)}?`;
  26. }
  27. throw new error_1.FirebaseError(message);
  28. });