UNPKG

bicep-assets

Version:
61 lines (60 loc) 2.88 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InitCommand = void 0; const clipanion_1 = require("clipanion"); const configuration_1 = require("../configuration"); class InitCommand extends clipanion_1.Command { constructor() { super(...arguments); this.resourceGroup = clipanion_1.Option.String('-g,--resource-group', { description: 'The resource group to use for the deployment. When not provided it will try to suggest from the current az login state', required: false, }); this.subscription = clipanion_1.Option.String('-s,--subscription', { description: 'The subscription to use for the deployment. When not provided it will try to suggest from the current az login state', required: false, }); this.forceReevaluate = clipanion_1.Option.Boolean('-f,--force', false, { description: 'Force a reevaluation/redeploy even if the concept is already initialized correctly', }); } execute() { return __awaiter(this, void 0, void 0, function* () { console.log('Setting up configuration...\n'); const config = yield configuration_1.Configuration.load(true, this.forceReevaluate); console.log(); console.log('Configuration:'); console.log(' subscription: ', config.subscription); console.log(' resource group: ', config.resourceGroup); console.log(' storage account name: ', config.storageAccountName); console.log(' assets:'); for (const asset of config.assets) { console.log(' - ', asset.name, '(', asset.path, ')'); } console.log(); }); } } exports.InitCommand = InitCommand; InitCommand.paths = [ ['init'], ]; InitCommand.usage = clipanion_1.Command.Usage({ description: 'Initializes the bicep assets configuration', details: ` This command will initialize the bicep assets configuration. It will create a the bicep-assets-config.yaml with the assets: - subscription - resource group - storage account name `, });