Skip to content

Commit cbd7a5a

Browse files
committed
feat: review feedback changes [internal]
1 parent 5679f70 commit cbd7a5a

3 files changed

Lines changed: 25 additions & 16 deletions

File tree

docs/reference.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,14 +1655,15 @@ FLAGS
16551655
DESCRIPTION
16561656
Publishes the task on its public landing page.
16571657
The task must belong to a public Actor and have its public display
1658-
configuration set up (in Apify Console, on the task Publication tab).
1658+
configuration set up (in Apify Console, on the task Publication tab). Requires
1659+
write access to the task and to its Actor.
16591660
16601661
USAGE
16611662
$ apify task publish <taskId>
16621663
16631664
ARGUMENTS
1664-
taskId Name or ID of the Task to publish (e.g. "my-task" or
1665-
"E2jjCZBezvAZnX8Rb").
1665+
taskId Name of the Task to publish, or its full name (e.g. "my-task" or
1666+
"username/my-task").
16661667
```
16671668
16681669
##### `apify task unpublish`
@@ -1671,14 +1672,14 @@ ARGUMENTS
16711672
DESCRIPTION
16721673
Unpublishes the task from its public landing page.
16731674
The public display configuration is preserved, so the task can be published
1674-
again later.
1675+
again later. Requires write access to the task and to its Actor.
16751676
16761677
USAGE
16771678
$ apify task unpublish <taskId>
16781679
16791680
ARGUMENTS
1680-
taskId Name or ID of the Task to unpublish (e.g. "my-task" or
1681-
"E2jjCZBezvAZnX8Rb").
1681+
taskId Name of the Task to unpublish, or its full name (e.g. "my-task"
1682+
or "username/my-task").
16821683
```
16831684
<!-- task-commands-end -->
16841685
<!-- prettier-ignore-end -->

src/commands/task/publish.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import chalk from 'chalk';
33

44
import { ApifyCommand } from '../../lib/command-framework/apify-command.js';
55
import { Args } from '../../lib/command-framework/args.js';
6+
import { CommandExitCodes } from '../../lib/consts.js';
67
import { error, success } from '../../lib/outputs.js';
78
import { getLocalUserInfo, getLoggedClientOrThrow } from '../../lib/utils.js';
89

@@ -12,16 +13,17 @@ export class TaskPublishCommand extends ApifyCommand<typeof TaskPublishCommand>
1213
static override description =
1314
'Publishes the task on its public landing page.\n' +
1415
'The task must belong to a public Actor and have its public display configuration set up ' +
15-
'(in Apify Console, on the task Publication tab).';
16+
'(in Apify Console, on the task Publication tab). ' +
17+
'Requires write access to the task and to its Actor.';
1618

1719
static override examples = [
1820
{
1921
description: 'Publish a task by name.',
2022
command: 'apify task publish my-task',
2123
},
2224
{
23-
description: 'Publish a task by full ID.',
24-
command: 'apify task publish E2jjCZBezvAZnX8Rb',
25+
description: 'Publish a task by its full name.',
26+
command: 'apify task publish username/my-task',
2527
},
2628
];
2729

@@ -30,7 +32,7 @@ export class TaskPublishCommand extends ApifyCommand<typeof TaskPublishCommand>
3032
static override args = {
3133
taskId: Args.string({
3234
required: true,
33-
description: 'Name or ID of the Task to publish (e.g. "my-task" or "E2jjCZBezvAZnX8Rb").',
35+
description: 'Name of the Task to publish, or its full name (e.g. "my-task" or "username/my-task").',
3436
}),
3537
};
3638

@@ -45,7 +47,8 @@ export class TaskPublishCommand extends ApifyCommand<typeof TaskPublishCommand>
4547

4648
const task = await taskClient.get();
4749
if (!task) {
48-
error({ message: `Cannot find Task with ID or name '${taskId}' in your account.` });
50+
error({ message: `Cannot find Task with name '${taskId}' in your account.` });
51+
process.exitCode = CommandExitCodes.NotFound;
4952
return;
5053
}
5154

@@ -62,6 +65,7 @@ export class TaskPublishCommand extends ApifyCommand<typeof TaskPublishCommand>
6265
error({
6366
message: `Failed to publish Task ${chalk.yellow(task.name)}\n ${casted.message || casted}`,
6467
});
68+
process.exitCode = CommandExitCodes.RunFailed;
6569
}
6670
}
6771
}

src/commands/task/unpublish.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import chalk from 'chalk';
33

44
import { ApifyCommand } from '../../lib/command-framework/apify-command.js';
55
import { Args } from '../../lib/command-framework/args.js';
6+
import { CommandExitCodes } from '../../lib/consts.js';
67
import { error, success } from '../../lib/outputs.js';
78
import { getLocalUserInfo, getLoggedClientOrThrow } from '../../lib/utils.js';
89

@@ -11,16 +12,17 @@ export class TaskUnpublishCommand extends ApifyCommand<typeof TaskUnpublishComma
1112

1213
static override description =
1314
'Unpublishes the task from its public landing page.\n' +
14-
'The public display configuration is preserved, so the task can be published again later.';
15+
'The public display configuration is preserved, so the task can be published again later. ' +
16+
'Requires write access to the task and to its Actor.';
1517

1618
static override examples = [
1719
{
1820
description: 'Unpublish a task by name.',
1921
command: 'apify task unpublish my-task',
2022
},
2123
{
22-
description: 'Unpublish a task by full ID.',
23-
command: 'apify task unpublish E2jjCZBezvAZnX8Rb',
24+
description: 'Unpublish a task by its full name.',
25+
command: 'apify task unpublish username/my-task',
2426
},
2527
];
2628

@@ -29,7 +31,7 @@ export class TaskUnpublishCommand extends ApifyCommand<typeof TaskUnpublishComma
2931
static override args = {
3032
taskId: Args.string({
3133
required: true,
32-
description: 'Name or ID of the Task to unpublish (e.g. "my-task" or "E2jjCZBezvAZnX8Rb").',
34+
description: 'Name of the Task to unpublish, or its full name (e.g. "my-task" or "username/my-task").',
3335
}),
3436
};
3537

@@ -44,7 +46,8 @@ export class TaskUnpublishCommand extends ApifyCommand<typeof TaskUnpublishComma
4446

4547
const task = await taskClient.get();
4648
if (!task) {
47-
error({ message: `Cannot find Task with ID or name '${taskId}' in your account.` });
49+
error({ message: `Cannot find Task with name '${taskId}' in your account.` });
50+
process.exitCode = CommandExitCodes.NotFound;
4851
return;
4952
}
5053

@@ -61,6 +64,7 @@ export class TaskUnpublishCommand extends ApifyCommand<typeof TaskUnpublishComma
6164
error({
6265
message: `Failed to unpublish Task ${chalk.yellow(task.name)}\n ${casted.message || casted}`,
6366
});
67+
process.exitCode = CommandExitCodes.RunFailed;
6468
}
6569
}
6670
}

0 commit comments

Comments
 (0)