Skip to content

Commit

Permalink
Merge pull request #1124 from salesforcecli/sh/clarify-package-name-flag
Browse files Browse the repository at this point in the history
fix: clarify help docs and command output for package-name flag
  • Loading branch information
shetzel authored Aug 13, 2024
2 parents 1de8e77 + d141ffd commit 4b3c957
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion messages/retrieve.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ Metadata component names to retrieve. Wildcards (`*`) supported as long as you u

# flags.package-name.summary

Package names to retrieve.
Package names to retrieve. Use of this flag is for reference only; don't use it to retrieve packaged metadata for development.

# flags.package-name.description

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).

# flags.source-dir.summary

Expand Down
1 change: 1 addition & 0 deletions src/commands/project/retrieve/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
'package-name': Flags.string({
char: 'n',
summary: messages.getMessage('flags.package-name.summary'),
description: messages.getMessage('flags.package-name.description'),
multiple: true,
}),
'output-dir': Flags.directory({
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/retrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ export class RetrieveResultFormatter implements Formatter<RetrieveResultJson> {
name: { header: 'Package Name' },
fullPath: { header: 'Converted Location' },
};
const title = 'Retrieved Packages';
const options = { title: tableHeader(title), 'no-truncate': true };
const options = { title: tableHeader('Retrieved Packages'), 'no-truncate': true };
this.ux.log();
this.ux.warn('Metadata from retrieved packages is meant for your reference only, not development.');
this.ux.table(packages, columns, options);
}
}
Expand Down
10 changes: 9 additions & 1 deletion test/commands/retrieve/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('project retrieve start', () => {
const testOrg = new MockTestOrgData();
testOrg.tracksSource = true;
let sfCommandUxStubs: ReturnType<typeof stubSfCommandUx>;
let uxStubs: ReturnType<typeof stubUx>;

testOrg.username = '[email protected]';
const packageXml = 'package.xml';
Expand Down Expand Up @@ -71,7 +72,7 @@ describe('project retrieve start', () => {
);

sfCommandUxStubs = stubSfCommandUx($$.SANDBOX);
stubUx($$.SANDBOX);
uxStubs = stubUx($$.SANDBOX);
stubSpinner($$.SANDBOX);
$$.setConfigStubContents('SfProjectJson', {
contents: {
Expand Down Expand Up @@ -250,6 +251,13 @@ describe('project retrieve start', () => {
ensureRetrieveArgs({ packageOptions: packagenames, format: 'source' });
});

it('should display warning when using package-name flag', async () => {
await RetrieveMetadata.run(['--package-name', 'package1']);
expect(uxStubs.warn.firstCall.args[0]).to.equal(
'Metadata from retrieved packages is meant for your reference only, not development.'
);
});

it('should pass along multiple packagenames', async () => {
const manifest = 'package.xml';
const packagenames = ['package1', 'package2'];
Expand Down

0 comments on commit 4b3c957

Please sign in to comment.