Skip to content

Commit

Permalink
chore: refactor long fn out
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Dec 5, 2023
1 parent 30c43e9 commit ab5bc89
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/commands/project/retrieve/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,7 @@ const buildRetrieveAndDeleteTargets = async (
}
return result;
} else {
// check if we're retrieving metadata based on a pattern ...
let retrieveFromOrg: string | undefined;
if (flags.metadata) {
flags.metadata.some((mdEntry) => {
const mdName = mdEntry.split(':')[1];
if (mdName?.includes('*') && mdName?.length > 1 && !mdName?.includes('.*')) {
retrieveFromOrg = flags['target-org'].getUsername();
return true;
}
return false;
});
}
const retrieveFromOrg = flags.metadata?.some(isWildcard) ? flags['target-org'].getUsername() : undefined;

return {
componentSetFromNonDeletes: await ComponentSetBuilder.build({
Expand Down Expand Up @@ -449,3 +438,9 @@ const buildRetrieveOptions = async (
output: output ?? (await SfProject.resolve()).getDefaultPackage().fullPath,
}),
});

// check if we're retrieving metadata based on a pattern ...
const isWildcard = (mdEntry: string): boolean => {
const mdName = mdEntry.split(':')[1];
return mdName?.includes('*') && mdName?.length > 1 && !mdName?.includes('.*');
};

0 comments on commit ab5bc89

Please sign in to comment.