UNPKG

growthbook

Version:

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

32 lines (31 loc) 1.35 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 projects_repository_1 = require("../../repositories/projects.repository"); class ProjectsList extends core_1.Command { async run() { const { flags: { profile, apiBaseUrl, limit, offset, }, } = await this.parse(ProjectsList); 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 projectsRepo = new projects_repository_1.ProjectsRepository({ apiKey, apiBaseUrl: baseUrlUsed, }); const projects = await projectsRepo.listProjects(limit, offset); this.logJson(projects); } } exports.default = ProjectsList; ProjectsList.description = 'List all projects'; ProjectsList.examples = [ '<%= config.bin %> <%= command.id %>', ]; ProjectsList.flags = { ...cli_1.baseGrowthBookCliFlags, ...cli_1.paginationCliFlags, }; ProjectsList.args = {};