Skip to content

Commit

Permalink
docs(push): documentation change on source:push:delete (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
olamothe authored Jul 15, 2021
1 parent 7f5769c commit 04cd720
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
12 changes: 6 additions & 6 deletions packages/cli/src/commands/source/push/delete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('source:push:delete', () => {
test
.stdout()
.command(['source:push:delete', 'mysource'])
.catch(/You must provide either --delete= or --deleteOlderThan=/)
.catch(/ou must minimally set the `delete` or the `deleteOlderThan` flag/)
.it('throws when no flags are specified');

test
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('source:push:delete', () => {
'returns an information message on successful deletion with older than',
(ctx) => {
expect(ctx.stdout).toContain(
'Successfully deleted document: older than 12345'
'The delete request for document: older than 12345 was accepted by the Push AP'
);
expect(ctx.stdout).toContain('Status code: 999 this document is gone');
}
Expand Down Expand Up @@ -143,7 +143,7 @@ describe('source:push:delete', () => {
'returns an information message on successful deletion with document uri',
(ctx) => {
expect(ctx.stdout).toContain(
'Successfully deleted document: https://foo.com'
'The delete request for document: https://foo.com was accepted by the Push API'
);
expect(ctx.stdout).toContain('Status code: 999 this document is gone');
}
Expand All @@ -163,10 +163,10 @@ describe('source:push:delete', () => {
'returns an information message on successful deletion with multiple document uri',
(ctx) => {
expect(ctx.stdout).toContain(
'Successfully deleted document: https://foo.com'
'The delete request for document: https://foo.com was accepted by the Push API'
);
expect(ctx.stdout).toContain(
'Successfully deleted document: https://foo.com/2'
'The delete request for document: https://foo.com/2 was accepted by the Push API'
);
}
);
Expand Down Expand Up @@ -253,7 +253,7 @@ describe('source:push:delete', () => {
'Error while trying to delete document: https://foo.com'
);
expect(ctx.stdout).toContain(
'Successfully deleted document: https://foo.com/2'
'The delete request for document: https://foo.com/2 was accepted by the Push API'
);
}
);
Expand Down
18 changes: 10 additions & 8 deletions packages/cli/src/commands/source/push/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ interface AxiosResponse {

export default class SourcePushDelete extends Command {
public static description =
'Delete one or multiple documents in a given push source. See https://docs.coveo.com/en/171 and https://docs.coveo.com/en/131';
'Delete one or multiple items in a given Push source. See <https://docs.coveo.com/en/171> and <https://docs.coveo.com/en/131>';

public static flags = {
deleteOlderThan: flags.string({
char: 'd',
exclusive: ['delete'],
description:
'Delete old items, using either an ISO 8601 date or a Unix timestamp',
'If this flag is set, all items that have been added or updated in the source before the specified ISO 8601 date or Unix timestamp will be deleted. The documents will be deleted using the default queueDelay, meaning they will stay in the index for about 15 minutes after being marked for deletion.',
helpValue: '2000-01-01T00:00:00-06:00 OR 946702800',
}),
delete: flags.string({
char: 'x',
multiple: true,
description:
'Document URI or identfier to delete. Can be repeated. If you want to delete a large batch of documents, use source:push:batch command instead.',
'The URIs of the items to delete. Can be repeated. If you want to delete more than one specific items, use the `source:push:batch` command instead.',
}),
deleteChildren: flags.boolean({
char: 'c',
default: true,
description:
'Specify if children document should also be deleted. Default to `true`.',
'Whether to delete all items that share the same base URI as the specified item to delete.',
}),
};

Expand All @@ -58,7 +58,7 @@ export default class SourcePushDelete extends Command {
name: 'sourceId',
required: true,
description:
'The identifier of the source on which to perform the delete operation. See source:push:list to obtain the identifier.',
'The identifier of the Push source on which to perform the delete operation. To retrieve the list of available Push source identifiers, use the `source:push:list` command.',
},
];

Expand All @@ -67,7 +67,7 @@ export default class SourcePushDelete extends Command {
const {flags} = this.parse(SourcePushDelete);
if (!flags.deleteOlderThan && !flags.delete) {
this.error(
'You must provide either --delete= or --deleteOlderThan=. See source:push:delete --help for more information.'
'You must minimally set the `delete` or the `deleteOlderThan` flag. Use `source:push:delete --help` to get more information.'
);
}
const cfg = await new AuthenticatedClient().cfg.get();
Expand All @@ -82,7 +82,7 @@ export default class SourcePushDelete extends Command {
if (this.isNumberOfDeletionTooLarge) {
this.warn(
dedent(
'To delete large batch of documents, use source:push:batch command instead.'
'To delete large number of items, use the `source:push:batch` command instead.'
)
);
return;
Expand Down Expand Up @@ -147,7 +147,9 @@ export default class SourcePushDelete extends Command {
private successMessageOnDeletion(toDelete: string, res: AxiosResponse) {
this.log(
dedent(`
Successfully deleted document: ${green(toDelete)}
The delete request for document: ${green(
toDelete
)} was accepted by the Push API
Status code: ${green(res.status, res.statusText)}
`)
);
Expand Down

0 comments on commit 04cd720

Please sign in to comment.