UNPKG

cli-stash

Version:

CLI application to manage and work with Atlassian Stash. Work with your Stash project and repositories from Command lines.

41 lines (40 loc) 2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const stash_connector_1 = require("stash-connector"); const baseCommand_1 = require("../../../libs/core/baseCommand"); const stashResponse_1 = require("../../../libs/core/stashResponse"); const tables_1 = require("../../../libs/core/tables"); const ux_1 = require("../../../libs/core/ux"); class Update extends baseCommand_1.BaseCommand { async run() { const response = new stashResponse_1.StashCLIResponse(); const connector = new stash_connector_1.StashConnector(this.localConfig.getConnectorOptions(this.flags.alias)); try { const mailConfig = await connector.admin.mailServer().update(this.getJSONInputData()); response.message = this.getRecordUpdatedText('Mail Configuration'); response.status = 0; this.ux.log(response.message); this.ux.table([mailConfig], tables_1.MailHostColumns, { csv: this.flags.csv, extended: this.flags.extended || this.flags.csv }); } catch (error) { this.processError(response, error); } return response; } } exports.default = Update; Update.description = 'Updates the mail configuration. ' + ux_1.UX.processDocumentation('<doc:MailHostConfiguration>'); Update.examples = [ `$ stash admin:mail:update --data "{ 'username': 'user', 'sender-address': 'address@email.com' 'hostname': 'host', 'port': 4000, protocol: 'SMTP', 'use-start-tls': true, 'require-start-tls': true }"`, `$ stash admin:mail:update --file "path/to/json/data/file" --json`, ]; Update.flags = { ...baseCommand_1.BaseCommand.flags, csv: baseCommand_1.BuildFlags.csv, alias: baseCommand_1.BuildFlags.alias, data: baseCommand_1.BuildFlags.input.jsonData('<doc:MailHostConfiguration>', false), file: baseCommand_1.BuildFlags.input.jsonFile('<doc:MailHostConfiguration>', false) };