UNPKG

@adinsure-ops/ops-cli

Version:

Operations CLI for working with AdInsure

41 lines (40 loc) 1.36 kB
import { __awaiter } from "tslib"; import { Args } from '@oclif/core'; import CommandBase from '../../command.base.js'; import OpsConfig from '../../lib/config.js'; import chalk from 'chalk'; class ConfigGet extends CommandBase { run() { const _super = Object.create(null, { run: { get: () => super.run } }); return __awaiter(this, void 0, void 0, function* () { _super.run.call(this); const { args } = yield this.parse(ConfigGet); const configPath = this.security.getConfigPath(); const config = new OpsConfig(configPath); const value = config.get(args.type); if (value === undefined) { this.log(chalk.yellow(`No configuration found for '${args.type}'.`)); } else { this.log(chalk.green(`${args.type} = ${value}`)); } }); } } ConfigGet.aliases = ['config:get']; ConfigGet.description = 'Get a configuration value'; ConfigGet.usage = 'config:get <type>'; ConfigGet.examples = [ '$ ops config:get endpoint', '$ ops config:get download_folder', ]; ConfigGet.args = { type: Args.string({ description: 'Type of OPS configuration to retrieve', options: ['endpoint', 'download_folder'], required: true, }), }; export default ConfigGet;