UNPKG

growthbook

Version:

The GrowthBook command-line interface (CLI) for working with the GrowthBook A/B testing, feature flagging, and experimentation platform

36 lines (35 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const cli_1 = require("../../utils/cli"); const constants_1 = require("../../utils/constants"); const config_1 = require("../../utils/config"); const visual_changesets_repository_1 = require("../../repositories/visual-changesets.repository"); class VcsList extends core_1.Command { async run() { const { flags: { profile, apiBaseUrl, experiment, }, } = await this.parse(VcsList); const profileUsed = profile || constants_1.DEFAULT_GROWTHBOOK_PROFILE; const { apiKey, apiBaseUrl: configApiBaseUrl } = (0, config_1.getGrowthBookProfileConfigAndThrowForCommand)(profileUsed, this); const baseUrlUsed = apiBaseUrl || configApiBaseUrl || constants_1.DEFAULT_GROWTHBOOK_BASE_URL; const repo = new visual_changesets_repository_1.VisualChangesetsRepository({ apiKey, apiBaseUrl: baseUrlUsed, }); const visualChangesets = await repo.listVisualChangesets(experiment); this.logJson(visualChangesets); } } exports.default = VcsList; VcsList.description = 'List Visual Changesets created in the visual editor'; VcsList.examples = [ '<%= config.bin %> <%= command.id %>', ]; VcsList.flags = { ...cli_1.baseGrowthBookCliFlags, experiment: core_1.Flags.string({ char: 'e', description: 'Filter by experiment', required: true, }), }; VcsList.args = {};