UNPKG

get-sso-creds

Version:

CLI tool to retrieve or set AWS SSO credentials.

23 lines (22 loc) 760 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.logout = void 0; const child_process_1 = require("child_process"); const profile_helper_1 = require("./profile-helper"); const chalk = require("chalk"); async function logout(profile) { if (!(0, profile_helper_1.isProfile)(profile)) { throw new Error(`${chalk.redBright(profile)} is not a valid profile`); } return new Promise((resolve, reject) => { (0, child_process_1.exec)(`aws sso logout --profile ${profile}`, (error, stdout, stderr) => { if (stderr) { reject(new Error(stderr)); } if (stdout) { resolve(stdout); } }); }); } exports.logout = logout;