Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@
"httprequest",
"huggingface",
"iframe",
"ignoreconflicts",
"ignoreerrors",
"ignorerights",
"ignorewarnings",
Expand Down Expand Up @@ -998,6 +999,7 @@
"somevalue",
"sont",
"soql",
"sourcedir",
"sourcepath",
"sourceusername",
"squidfunk",
Expand Down
96 changes: 85 additions & 11 deletions src/commands/hardis/source/retrieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,48 +43,56 @@ This command acts as an intelligent wrapper around the Salesforce CLI's source r
// @ts-ignore force char override for backward compat
char: 'a',
}),
sourcepath: Flags.string({
sourcepath: Flags.string({ // deprecated, replaced by sourcedir
char: 'p',
description: 'sourcePath',
longDescription: 'sourcePath',
exclusive: ['manifest', 'metadata'],
multiple: true,
}),
wait: Flags.integer({
char: 'w',
description: 'wait',
sourcedir: Flags.string({
char: 'd',
description: 'sourceDir',
longDescription: 'sourceDir',
exclusive: ['manifest', 'metadata'],
multiple: true,
}),
manifest: Flags.directory({
char: 'x',
description: 'manifest',
exclusive: ['metadata', 'sourcepath'],
exclusive: ['metadata', 'sourcepath', 'sourcedir'],
}),
metadata: Flags.string({
char: 'm',
description: 'metadata',
longDescription: 'metadata',
exclusive: ['manifest', 'sourcepath'],
exclusive: ['manifest', 'sourcepath', 'sourcedir'],
multiple: true,
}),
packagenames: Flags.string({
char: 'n',
aliases: ['package-name'],
description: 'packagenames',
multiple: true,
}),
tracksource: Flags.boolean({
tracksource: Flags.boolean({ // deprecated
char: 't',
description: 'tracksource',
}),
forceoverwrite: Flags.boolean({
forceoverwrite: Flags.boolean({ // deprecated
char: 'f',
description: 'forceoverwrite',
dependsOn: ['tracksource'],
}),
ignoreconflicts: Flags.boolean({
char: 'c',
description: 'ignoreconflicts'
}),
verbose: Flags.boolean({
description: 'verbose',
}),
debug: Flags.boolean({
char: 'd',
// char: 'd', // deprecated, used by sourcedir, force --debug instead
default: false,
description: 'debugMode',
}),
Expand All @@ -99,6 +107,72 @@ This command acts as an intelligent wrapper around the Salesforce CLI's source r

public async run(): Promise<any> {
const { flags } = await this.parse(SourceRetrieve);
const args = this.argv;

if(args.includes('-d')){
uxLog("warning", this, c.red('The -d flag is deprecated for debug mode. Please use --debug instead.'));
}
if(flags.tracksource) {
uxLog("error", this, c.red('The --tracksource flag is not supported anymore.'));
process.exitCode = 1;
}
if(flags.forceoverwrite) {
uxLog("warning", this, c.red('The --forceoverwrite (-f) flag is not supported anymore. It is being automatically replaced by --ignore-conflicts (-c). Please use it going forward.'));
flags.ignoreconflicts = true;
if(args.includes('--forceoverwrite')) {
args.splice(args.indexOf('--forceoverwrite'), 1);
args.push('--ignore-conflicts');
}
if(args.includes('-f')) {
args.splice(args.indexOf('-f'), 1);
args.push('-c');
}
delete flags.forceoverwrite;
}
if(flags.packagenames) {
uxLog("warning", this, c.red('The --packagenames flag is not supported anymore. It is being automatically replaced by --package-names. Please use it going forward.'));
flags['package-name'] = flags.packagenames;
if(args.includes('--packagenames')) {
args.splice(args.indexOf('--packagenames'), 1);
args.push('--package-names');
}
delete flags.packagenames;
}
if(flags.sourcepath) {
uxLog("warning", this, c.red('The --sourcepath (-p) flag is not supported anymore. It is being automatically replaced by --source-dir (-d). Please use it going forward.'));
flags['source-dir'] = flags.sourcepath;
if(args.includes('--sourcepath')) {
args.splice(args.indexOf('--sourcepath'), 1);
args.push('--source-dir');
}
if(args.includes('-p')) {
args.splice(args.indexOf('-p'), 1);
args.push('--source-dir'); // wrap utils considers -d for debug only
}
delete flags.sourcepath;
}
if(flags.apiversion){
uxLog("warning", this, c.red('The --apiversion flag is not supported anymore. It is being automatically replaced by --api-version. Please use it going forward.'));
flags['api-version'] = flags.apiversion;
if(args.includes('--apiversion')) {
args.splice(args.indexOf('--apiversion'), 1);
args.push('--api-version');
}
delete flags.apiversion;
}
if(flags.targetusername){
uxLog("warning", this, c.red('The --target-username (-u) flag is not supported anymore. It is being automatically replaced by --target-org (-o). Please use it going forward.'));
flags['target-org'] = flags.targetusername;
if(args.includes('--targetusername')) {
args.splice(args.indexOf('--targetusername'), 1);
args.push('--target-org');
}
if(args.includes('-u')) {
args.splice(args.indexOf('-u'), 1);
args.push('-o');
}
delete flags.targetusername;
}
uxLog("error", this, c.red('This command will be removed by Salesforce in November 2024.'));
uxLog("error", this, c.red('Please migrate to command sf hardis project retrieve start'));
uxLog(
Expand All @@ -108,7 +182,7 @@ This command acts as an intelligent wrapper around the Salesforce CLI's source r
'See https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_mig_deploy_retrieve.htm'
)
);
const args = this.argv;

// Manage user selection for metadatas
if (!isCI && !flags.sourcepath && !flags.manifest && !flags.metadata && !flags.packagenames) {
const metadatas = await MetadataUtils.promptMetadataTypes();
Expand All @@ -125,7 +199,7 @@ This command acts as an intelligent wrapper around the Salesforce CLI's source r
throw new SfError(c.yellow('For technical reasons, run again this command and select your org in the list 😊'));
}
}
return await wrapSfdxCoreCommand('sfdx force:source:retrieve', args, this, flags.debug);
return await wrapSfdxCoreCommand('sf project retrieve start', args, this, flags.debug);
}
}
/* jscpd:ignore-end */
Loading