@@ -3,6 +3,7 @@ import chalk from 'chalk';
33
44import { ApifyCommand } from '../../lib/command-framework/apify-command.js' ;
55import { Args } from '../../lib/command-framework/args.js' ;
6+ import { CommandExitCodes } from '../../lib/consts.js' ;
67import { error , success } from '../../lib/outputs.js' ;
78import { 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}
0 commit comments