UNPKG

eas-cli

Version:
80 lines (79 loc) 3.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EasUpdateEnvironmentFlag = exports.EasJsonOnlyFlag = exports.EASNonInteractiveFlag = exports.EASEnvironmentVariableScopeFlag = exports.EASVariableVisibilityFlag = exports.EASVariableFormatFlag = exports.EASMultiEnvironmentFlag = exports.EASEnvironmentFlag = exports.EasEnvironmentFlagParameters = exports.EasNonInteractiveAndJsonFlags = void 0; const core_1 = require("@oclif/core"); const generated_1 = require("../graphql/generated"); // NOTE: not exactly true, but, provided mapToLowercase and upperCaseAsync // are used in tandem, it saves on unnecessary typying in commands async function upperCaseAsync(input) { return input.toUpperCase(); } function mapToLowercase(options) { return options.map(option => option.toLowerCase()); } exports.EasNonInteractiveAndJsonFlags = { json: core_1.Flags.boolean({ description: 'Enable JSON output, non-JSON messages will be printed to stderr.', dependsOn: ['non-interactive'], }), 'non-interactive': core_1.Flags.boolean({ description: 'Run the command in non-interactive mode.', }), }; exports.EasEnvironmentFlagParameters = { description: "Environment variable's environment", parse: upperCaseAsync, options: mapToLowercase([ generated_1.EnvironmentVariableEnvironment.Development, generated_1.EnvironmentVariableEnvironment.Preview, generated_1.EnvironmentVariableEnvironment.Production, ]), }; exports.EASEnvironmentFlag = { environment: core_1.Flags.enum(exports.EasEnvironmentFlagParameters), }; exports.EASMultiEnvironmentFlag = { environment: core_1.Flags.enum({ ...exports.EasEnvironmentFlagParameters, multiple: true, }), }; exports.EASVariableFormatFlag = { format: core_1.Flags.enum({ description: 'Output format', options: ['long', 'short'], default: 'short', }), }; exports.EASVariableVisibilityFlag = { visibility: core_1.Flags.enum({ description: 'Visibility of the variable', options: ['plaintext', 'sensitive', 'secret'], }), }; exports.EASEnvironmentVariableScopeFlag = { scope: core_1.Flags.enum({ description: 'Scope for the variable', options: ['project', 'account'], default: 'project', }), }; exports.EASNonInteractiveFlag = { 'non-interactive': core_1.Flags.boolean({ description: 'Run the command in non-interactive mode.', }), }; exports.EasJsonOnlyFlag = { json: core_1.Flags.boolean({ description: 'Enable JSON output, non-JSON messages will be printed to stderr.', }), }; exports.EasUpdateEnvironmentFlag = { environment: core_1.Flags.enum({ description: 'Environment to use for the server-side defined EAS environment variables during command execution.', options: mapToLowercase(Object.values(generated_1.EnvironmentVariableEnvironment)), parse: upperCaseAsync, required: false, default: null, }), };