Skip to content

Commit

Permalink
Update tests to pass after removing duplicate IdPs. Minor refactor to…
Browse files Browse the repository at this point in the history
… idp-export.ts to be consistent with other exports.
  • Loading branch information
phalestrivir committed Dec 10, 2024
1 parent 7bd9496 commit 02c614a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2,231 deletions.
80 changes: 39 additions & 41 deletions src/cli/idp/idp-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,47 +56,45 @@ export default function setup() {
options,
command
);
if (await getTokens()) {
// export by id/name
if (options.idpId) {
verboseMessage(
`Exporting provider "${
options.idpId
}" from realm "${state.getRealm()}"...`
);
const outcome = await exportSocialIdentityProviderToFile(
options.idpId,
options.file,
options.metadata
);
if (!outcome) process.exitCode = 1;
}
// --all -a
else if (options.all) {
verboseMessage('Exporting all providers to a single file...');
const outcome = await exportSocialIdentityProvidersToFile(
options.file,
options.metadata
);
if (!outcome) process.exitCode = 1;
}
// --all-separate -A
else if (options.allSeparate) {
verboseMessage('Exporting all providers to separate files...');
const outcome = await exportSocialIdentityProvidersToFiles(
options.metadata
);
if (!outcome) process.exitCode = 1;
}
// unrecognized combination of options or no options
else {
printMessage(
'Unrecognized combination of options or no options...',
'error'
);
program.help();
process.exitCode = 1;
}
// export by id/name
if (options.idpId && (await getTokens())) {
verboseMessage(
`Exporting provider "${
options.idpId
}" from realm "${state.getRealm()}"...`
);
const outcome = await exportSocialIdentityProviderToFile(
options.idpId,
options.file,
options.metadata
);
if (!outcome) process.exitCode = 1;
}
// --all -a
else if (options.all && (await getTokens())) {
verboseMessage('Exporting all providers to a single file...');
const outcome = await exportSocialIdentityProvidersToFile(
options.file,
options.metadata
);
if (!outcome) process.exitCode = 1;
}
// --all-separate -A
else if (options.allSeparate && (await getTokens())) {
verboseMessage('Exporting all providers to separate files...');
const outcome = await exportSocialIdentityProvidersToFiles(
options.metadata
);
if (!outcome) process.exitCode = 1;
}
// unrecognized combination of options or no options
else {
printMessage(
'Unrecognized combination of options or no options...',
'error'
);
program.help();
process.exitCode = 1;
}
}
// end command logic inside action handler
Expand Down
Loading

0 comments on commit 02c614a

Please sign in to comment.