From b3e9e7cc4298ac9a687c68dbcaf4bf4436ac1310 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Fri, 19 May 2023 10:02:58 -0500 Subject: [PATCH 1/2] feat: flag groups for deploy/retrieve --- src/commands/project/deploy/start.ts | 24 +++++++++++++++++++++--- src/commands/project/retrieve/start.ts | 6 ++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/commands/project/deploy/start.ts b/src/commands/project/deploy/start.ts index e1ea3921..9f7bb759 100644 --- a/src/commands/project/deploy/start.ts +++ b/src/commands/project/deploy/start.ts @@ -25,6 +25,10 @@ Messages.importMessagesDirectory(__dirname); const messages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata'); const exclusiveFlags = ['manifest', 'source-dir', 'metadata', 'metadata-dir']; +const mdapiFormatFlags = 'Metadata API Format Option'; +const sourceFormatFlags = 'Source Format'; +const testFlags = 'Test'; +const destructiveFlags = 'Delete'; export default class DeployMetadata extends SfCommand { public static readonly description = messages.getMessage('description'); @@ -76,21 +80,25 @@ export default class DeployMetadata extends SfCommand { summary: messages.getMessage('flags.manifest.summary'), exclusive: exclusiveFlags.filter((f) => f !== 'manifest'), exists: true, + helpGroup: sourceFormatFlags, }), metadata: Flags.string({ char: 'm', summary: messages.getMessage('flags.metadata.summary'), multiple: true, exclusive: exclusiveFlags.filter((f) => f !== 'metadata'), + helpGroup: sourceFormatFlags, }), 'metadata-dir': fileOrDirFlag({ summary: messages.getMessage('flags.metadata-dir.summary'), exclusive: exclusiveFlags.filter((f) => f !== 'metadata-dir'), exists: true, + helpGroup: mdapiFormatFlags, }), 'single-package': Flags.boolean({ summary: messages.getMessage('flags.single-package.summary'), dependsOn: ['metadata-dir'], + helpGroup: mdapiFormatFlags, }), 'source-dir': Flags.string({ char: 'd', @@ -98,6 +106,7 @@ export default class DeployMetadata extends SfCommand { summary: messages.getMessage('flags.source-dir.summary'), multiple: true, exclusive: exclusiveFlags.filter((f) => f !== 'source-dir'), + helpGroup: sourceFormatFlags, }), 'target-org': Flags.requiredOrg({ char: 'o', @@ -105,11 +114,12 @@ export default class DeployMetadata extends SfCommand { summary: messages.getMessage('flags.target-org.summary'), required: true, }), - tests: testsFlag, + tests: { ...testsFlag, helpGroup: testFlags }, 'test-level': testLevelFlag({ description: messages.getMessage('flags.test-level.description'), summary: messages.getMessage('flags.test-level.summary'), options: [TestLevel.NoTestRun, TestLevel.RunSpecifiedTests, TestLevel.RunLocalTests, TestLevel.RunAllTestsInOrg], + helpGroup: testFlags, }), verbose: Flags.boolean({ summary: messages.getMessage('flags.verbose.summary'), @@ -129,20 +139,28 @@ export default class DeployMetadata extends SfCommand { summary: messages.getMessage('flags.purge-on-delete.summary'), dependsOn: ['manifest'], relationships: [{ type: 'some', flags: ['pre-destructive-changes', 'post-destructive-changes'] }], + helpGroup: destructiveFlags, }), 'pre-destructive-changes': Flags.file({ summary: messages.getMessage('flags.pre-destructive-changes.summary'), dependsOn: ['manifest'], + helpGroup: destructiveFlags, }), 'post-destructive-changes': Flags.file({ summary: messages.getMessage('flags.post-destructive-changes.summary'), dependsOn: ['manifest'], + helpGroup: destructiveFlags, + }), + 'coverage-formatters': { ...coverageFormattersFlag, helpGroup: testFlags }, + junit: Flags.boolean({ + summary: messages.getMessage('flags.junit.summary'), + dependsOn: ['coverage-formatters'], + helpGroup: testFlags, }), - 'coverage-formatters': coverageFormattersFlag, - junit: Flags.boolean({ summary: messages.getMessage('flags.junit.summary'), dependsOn: ['coverage-formatters'] }), 'results-dir': Flags.directory({ dependsOn: ['coverage-formatters'], summary: messages.getMessage('flags.results-dir.summary'), + helpGroup: testFlags, }), }; diff --git a/src/commands/project/retrieve/start.ts b/src/commands/project/retrieve/start.ts index 1b5b80e7..0f8b444e 100644 --- a/src/commands/project/retrieve/start.ts +++ b/src/commands/project/retrieve/start.ts @@ -35,6 +35,8 @@ const messages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 're const mdTransferMessages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'metadata.transfer'); type Format = 'source' | 'metadata'; +const mdapiFlagGroup = 'Metadata API Format Option'; + export default class RetrieveMetadata extends SfCommand { public static readonly summary = messages.getMessage('summary'); public static readonly description = messages.getMessage('description'); @@ -76,6 +78,7 @@ export default class RetrieveMetadata extends SfCommand { summary: messages.getMessage('flags.single-package.summary'), dependsOn: ['target-metadata-dir'], exclusive: ['ignore-conflicts'], + helpGroup: mdapiFlagGroup, }), 'source-dir': Flags.string({ char: 'd', @@ -94,6 +97,7 @@ export default class RetrieveMetadata extends SfCommand { }, ], exclusive: ['ignore-conflicts'], + helpGroup: mdapiFlagGroup, }), 'target-org': Flags.requiredOrg({ char: 'o', @@ -114,11 +118,13 @@ export default class RetrieveMetadata extends SfCommand { summary: messages.getMessage('flags.unzip.summary'), dependsOn: ['target-metadata-dir'], exclusive: ['ignore-conflicts'], + helpGroup: mdapiFlagGroup, }), 'zip-file-name': zipFileFlag({ summary: messages.getMessage('flags.zip-file-name.summary'), dependsOn: ['target-metadata-dir'], exclusive: ['ignore-conflicts'], + helpGroup: mdapiFlagGroup, }), }; From 2f5196b05072077e8d09d51a23fdba952182afbe Mon Sep 17 00:00:00 2001 From: Shane McLaughlin Date: Tue, 23 May 2023 09:55:01 -0500 Subject: [PATCH 2/2] docs: apply suggestions from code review Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com> --- src/commands/project/deploy/start.ts | 2 +- src/commands/project/retrieve/start.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/project/deploy/start.ts b/src/commands/project/deploy/start.ts index 9f7bb759..75bccd04 100644 --- a/src/commands/project/deploy/start.ts +++ b/src/commands/project/deploy/start.ts @@ -25,7 +25,7 @@ Messages.importMessagesDirectory(__dirname); const messages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata'); const exclusiveFlags = ['manifest', 'source-dir', 'metadata', 'metadata-dir']; -const mdapiFormatFlags = 'Metadata API Format Option'; +const mdapiFormatFlags = 'Metadata API Format'; const sourceFormatFlags = 'Source Format'; const testFlags = 'Test'; const destructiveFlags = 'Delete'; diff --git a/src/commands/project/retrieve/start.ts b/src/commands/project/retrieve/start.ts index 0f8b444e..8be30906 100644 --- a/src/commands/project/retrieve/start.ts +++ b/src/commands/project/retrieve/start.ts @@ -35,7 +35,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 're const mdTransferMessages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'metadata.transfer'); type Format = 'source' | 'metadata'; -const mdapiFlagGroup = 'Metadata API Format Option'; +const mdapiFlagGroup = 'Metadata API Format'; export default class RetrieveMetadata extends SfCommand { public static readonly summary = messages.getMessage('summary');