diff --git a/command-snapshot.json b/command-snapshot.json index 8175ffac..11775805 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -234,7 +234,7 @@ { "command": "project:retrieve:preview", "plugin": "@salesforce/plugin-deploy-retrieve", - "flags": ["ignore-conflicts", "json", "target-org"], + "flags": ["ignore-conflicts", "json", "target-org", "concise"], "alias": ["retrieve:metadata:preview"], "flagChars": ["c", "o"], "flagAliases": [] diff --git a/messages/retrieve.metadata.preview.md b/messages/retrieve.metadata.preview.md index bc456ceb..92c676d4 100644 --- a/messages/retrieve.metadata.preview.md +++ b/messages/retrieve.metadata.preview.md @@ -40,6 +40,10 @@ This flag applies only to orgs that allow source tracking. It has no effect on o Omit ignored files. +# flags.concise.description + +Show only the changes that will be retrieved; omits files that are forceignored. + # flags.api-version.summary Target API version for the deploy. diff --git a/src/commands/project/retrieve/preview.ts b/src/commands/project/retrieve/preview.ts index 4b67866f..b5976d55 100644 --- a/src/commands/project/retrieve/preview.ts +++ b/src/commands/project/retrieve/preview.ts @@ -36,6 +36,11 @@ export default class RetrieveMetadataPreview extends SfCommand { summary: messages.getMessage('flags.target-org.summary'), required: true, }), + concise: Flags.boolean({ + summary: messages.getMessage('flags.concise.summary'), + description: messages.getMessage('flags.concise.description'), + default: false, + }), }; public async run(): Promise { @@ -65,7 +70,7 @@ export default class RetrieveMetadataPreview extends SfCommand { }); if (!this.jsonEnabled()) { - printTables(output, 'retrieve'); + printTables(output, 'retrieve', flags.concise); } return output; } diff --git a/src/utils/previewOutput.ts b/src/utils/previewOutput.ts index 32c2dc52..d9e726f3 100644 --- a/src/utils/previewOutput.ts +++ b/src/utils/previewOutput.ts @@ -251,7 +251,7 @@ export const printIgnoredTable = (files: PreviewFile[], baseOperation: BaseOpera } }; -export const printTables = (result: PreviewResult, baseOperation: BaseOperation): void => { +export const printTables = (result: PreviewResult, baseOperation: BaseOperation, concise = false): void => { printConflictsTable(result.conflicts); printDeleteTable(result.toDelete); if (baseOperation === 'deploy') { @@ -260,7 +260,9 @@ export const printTables = (result: PreviewResult, baseOperation: BaseOperation) printRetrieveTable(result.toRetrieve); } - printIgnoredTable(result.ignored, baseOperation); + if (!concise) { + printIgnoredTable(result.ignored, baseOperation); + } }; export const getConflictFiles = async (stl?: SourceTracking, ignore = false): Promise> => diff --git a/test/nuts/tracking/forceIgnore.nut.ts b/test/nuts/tracking/forceIgnore.nut.ts index 464a408c..70005222 100644 --- a/test/nuts/tracking/forceIgnore.nut.ts +++ b/test/nuts/tracking/forceIgnore.nut.ts @@ -192,5 +192,14 @@ describe('forceignore changes', () => { }).jsonOutput?.result; expect(pullOutput?.files.length).to.equal(0); }); + + it('will not display ignored files with --concise', () => { + // gets file into source tracking + const output = execCmd('project:retrieve:preview --concise', { + ensureExitCode: 0, + }).shellOutput.stdout; + expect(output).to.not.include("These files won't retrieve because they're ignored by your .forceignore file."); + expect(output).to.not.include('ApexClass CreatedClass'); + }); }); });