@@ -2,6 +2,7 @@ import type { ActorTaggedBuild, ApifyApiError } from 'apify-client';
22
33import { ApifyCommand } from '../../lib/command-framework/apify-command.js' ;
44import { Args } from '../../lib/command-framework/args.js' ;
5+ import { YesFlag } from '../../lib/command-framework/flags.js' ;
56import { useInputConfirmation } from '../../lib/hooks/user-confirmations/useInputConfirmation.js' ;
67import { useYesNoConfirm } from '../../lib/hooks/user-confirmations/useYesNoConfirm.js' ;
78import { error , info , success } from '../../lib/outputs.js' ;
@@ -33,8 +34,13 @@ export class BuildsRmCommand extends ApifyCommand<typeof BuildsRmCommand> {
3334 } ) ,
3435 } ;
3536
37+ static override flags = {
38+ ...YesFlag ,
39+ } ;
40+
3641 async run ( ) {
3742 const { buildId } = this . args ;
43+ const { yes } = this . flags ;
3844
3945 const apifyClient = await getLoggedClientOrThrow ( ) ;
4046
@@ -60,11 +66,21 @@ export class BuildsRmCommand extends ApifyCommand<typeof BuildsRmCommand> {
6066 }
6167
6268 // If the build is tagged, console asks you to confirm by typing in the tag. Otherwise, it asks you to confirm with a yes/no question.
63- const confirmed = await ( confirmationPrompt ? useInputConfirmation : useYesNoConfirm ) ( {
64- message : `Are you sure you want to delete this Actor Build?${ confirmationPrompt ? ` If so, please type in "${ confirmationPrompt } ":` : '' } ` ,
65- expectedValue : confirmationPrompt ?? '' ,
66- failureMessage : 'Your provided value does not match the build tag.' ,
67- } ) ;
69+ let confirmed : string | boolean ;
70+
71+ if ( confirmationPrompt ) {
72+ confirmed = await useInputConfirmation ( {
73+ message : `Are you sure you want to delete this Actor Build? If so, please type in "${ confirmationPrompt } ":` ,
74+ expectedValue : confirmationPrompt ,
75+ failureMessage : 'Your provided value does not match the build tag.' ,
76+ providedConfirmFromStdin : yes ? confirmationPrompt : undefined ,
77+ } ) ;
78+ } else {
79+ confirmed = await useYesNoConfirm ( {
80+ message : `Are you sure you want to delete this Actor Build?` ,
81+ providedConfirmFromStdin : yes || undefined ,
82+ } ) ;
83+ }
6884
6985 if ( ! confirmed ) {
7086 info ( {
0 commit comments