UNPKG

@vortex.so/cli

Version:

CLI to interact with Vortex.

63 lines (60 loc) 1.48 kB
import { defineCommand } from 'citty'; import prompts from 'prompts'; import 'node:process'; import c from 'chalk'; import 'figures'; import 'jiti'; import { Log } from '../../../utils/log/index.mjs'; import { Vault } from '../../../plugins/vault/vault.mjs'; const log = new Log("Ping"); const vaultCommand = defineCommand({ meta: { name: "vault", description: c.dim("Get your secrets!") }, args: { env: { type: "positional", alias: "e", description: "Environment to get secrets for.", required: false } }, async run({ args }) { prompts.override({ command: args.command }); try { const answers = await prompts([ { type: "select", name: "env", message: "What environment do you need the secrets for?", choices: [ { title: "local", value: "local", description: "Local environment." }, { title: "dev", value: "dev", description: "Development environment." }, { title: "prod", value: "prod", description: "Production environment." } ] } ]); if (answers.env) { await Vault.getEnv(answers.env); } else { log.abort(); } } catch (error) { log.fail(error?.message); } } }); export { vaultCommand };