UNPKG

@axway/axway-cli-oum

Version:

Axway Amplify platform organization and user management CLI

55 lines (48 loc) 1.45 kB
import { initPlatformAccount } from '@axway/amplify-cli-utils'; import snooplogg from 'snooplogg'; var remove = { aliases: [ 'rm' ], args: [ { name: 'org', desc: 'The organization name, id, or guid; defaults to the current org', required: true }, { name: 'user', desc: 'The user guid or email address', required: true } ], desc: 'Remove a user from an organization', options: { '--account [name]': 'The platform account to use', '--json': { callback: ({ ctx, value }) => ctx.jsonMode = value, desc: 'Outputs the result as JSON' } }, async action({ argv, cli, console }) { let { account, org, sdk } = await initPlatformAccount(argv.account, argv.org, argv.env); const { highlight, note } = snooplogg.styles; if (!argv.json) { console.log(`Account: ${highlight(account.name)}`); console.log(`Organization: ${highlight(org.name)} ${note(`(${org.guid})`)}\n`); } const { user } = await sdk.org.user.remove(account, org, argv.user); const results = { account: account.name, org, user }; if (argv.json) { console.log(JSON.stringify(results, null, 2)); } else { const name = `${results.user.firstname} ${results.user.lastname}`.trim(); console.log(`Successfully removed user "${highlight(name)}" from organization`); } await cli.emitAction('axway:oum:org:user:remove', results); } }; export { remove as default }; //# sourceMappingURL=remove.js.map