Skip to content

Commit 4b3c957

Browse files
authored
Merge pull request #1124 from salesforcecli/sh/clarify-package-name-flag
fix: clarify help docs and command output for package-name flag
2 parents 1de8e77 + d141ffd commit 4b3c957

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

messages/retrieve.start.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ Metadata component names to retrieve. Wildcards (`*`) supported as long as you u
103103

104104
# flags.package-name.summary
105105

106-
Package names to retrieve.
106+
Package names to retrieve. Use of this flag is for reference only; don't use it to retrieve packaged metadata for development.
107+
108+
# flags.package-name.description
109+
110+
The metadata of the supplied package name(s) will be retrieved into a child directory of the project. The name of that child directory matches the name of the package. The retrieved metadata is meant for your reference only, don't add it to a source control system for development and deployment. For package development, retrieve the metadata using a manifest (`--manifest` flag) or by targeting a source controlled package directory within your project (`--source-dir` flag).
107111

108112
# flags.source-dir.summary
109113

src/commands/project/retrieve/start.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
7777
'package-name': Flags.string({
7878
char: 'n',
7979
summary: messages.getMessage('flags.package-name.summary'),
80+
description: messages.getMessage('flags.package-name.description'),
8081
multiple: true,
8182
}),
8283
'output-dir': Flags.directory({

src/formatters/retrieveResultFormatter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ export class RetrieveResultFormatter implements Formatter<RetrieveResultJson> {
8080
name: { header: 'Package Name' },
8181
fullPath: { header: 'Converted Location' },
8282
};
83-
const title = 'Retrieved Packages';
84-
const options = { title: tableHeader(title), 'no-truncate': true };
83+
const options = { title: tableHeader('Retrieved Packages'), 'no-truncate': true };
8584
this.ux.log();
85+
this.ux.warn('Metadata from retrieved packages is meant for your reference only, not development.');
8686
this.ux.table(packages, columns, options);
8787
}
8888
}

test/commands/retrieve/start.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ describe('project retrieve start', () => {
3838
const testOrg = new MockTestOrgData();
3939
testOrg.tracksSource = true;
4040
let sfCommandUxStubs: ReturnType<typeof stubSfCommandUx>;
41+
let uxStubs: ReturnType<typeof stubUx>;
4142

4243
testOrg.username = 'retrieve-test@org.com';
4344
const packageXml = 'package.xml';
@@ -71,7 +72,7 @@ describe('project retrieve start', () => {
7172
);
7273

7374
sfCommandUxStubs = stubSfCommandUx($$.SANDBOX);
74-
stubUx($$.SANDBOX);
75+
uxStubs = stubUx($$.SANDBOX);
7576
stubSpinner($$.SANDBOX);
7677
$$.setConfigStubContents('SfProjectJson', {
7778
contents: {
@@ -250,6 +251,13 @@ describe('project retrieve start', () => {
250251
ensureRetrieveArgs({ packageOptions: packagenames, format: 'source' });
251252
});
252253

254+
it('should display warning when using package-name flag', async () => {
255+
await RetrieveMetadata.run(['--package-name', 'package1']);
256+
expect(uxStubs.warn.firstCall.args[0]).to.equal(
257+
'Metadata from retrieved packages is meant for your reference only, not development.'
258+
);
259+
});
260+
253261
it('should pass along multiple packagenames', async () => {
254262
const manifest = 'package.xml';
255263
const packagenames = ['package1', 'package2'];

0 commit comments

Comments
 (0)