UNPKG

cli-stash

Version:

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

46 lines (45 loc) 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const stash_connector_1 = require("stash-connector"); const baseCommand_1 = require("../../../../libs/core/baseCommand"); const stashResponse_1 = require("../../../../libs/core/stashResponse"); class Remove 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 message = 'User remove from the group successfully'; await connector.admin.users().removeGroup(this.flags.user, this.flags.group); response.status = 0; response.message = message; this.ux.log(response.message); } catch (error) { this.processError(response, error); } return response; } } exports.default = Remove; Remove.description = 'Remove a user from a group.'; Remove.examples = [ `$ stash admin:users:groups:remove -a MyStashAlias --user username --group group`, `$ stash admin:users:groups:remove -a MyStashAlias -u "username" -g "group" --json`, ]; Remove.flags = { ...baseCommand_1.BaseCommand.flags, alias: baseCommand_1.BuildFlags.alias, user: core_1.Flags.string({ description: 'The user to remove from the group.', char: 'u', name: 'User', required: true, }), group: core_1.Flags.string({ description: 'The group to remove user from.', char: 'g', name: 'Group', required: true, }), };