@@ -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' ;
@@ -19,8 +20,13 @@ export class BuildsRmCommand extends ApifyCommand<typeof BuildsRmCommand> {
1920 } ) ,
2021 } ;
2122
23+ static override flags = {
24+ ...YesFlag ,
25+ } ;
26+
2227 async run ( ) {
2328 const { buildId } = this . args ;
29+ const { yes } = this . flags ;
2430
2531 const apifyClient = await getLoggedClientOrThrow ( ) ;
2632
@@ -46,11 +52,21 @@ export class BuildsRmCommand extends ApifyCommand<typeof BuildsRmCommand> {
4652 }
4753
4854 // 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.
49- const confirmed = await ( confirmationPrompt ? useInputConfirmation : useYesNoConfirm ) ( {
50- message : `Are you sure you want to delete this Actor Build?${ confirmationPrompt ? ` If so, please type in "${ confirmationPrompt } ":` : '' } ` ,
51- expectedValue : confirmationPrompt ?? '' ,
52- failureMessage : 'Your provided value does not match the build tag.' ,
53- } ) ;
55+ let confirmed : string | boolean ;
56+
57+ if ( confirmationPrompt ) {
58+ confirmed = await useInputConfirmation ( {
59+ message : `Are you sure you want to delete this Actor Build? If so, please type in "${ confirmationPrompt } ":` ,
60+ expectedValue : confirmationPrompt ,
61+ failureMessage : 'Your provided value does not match the build tag.' ,
62+ providedConfirmFromStdin : yes ? confirmationPrompt : undefined ,
63+ } ) ;
64+ } else {
65+ confirmed = await useYesNoConfirm ( {
66+ message : `Are you sure you want to delete this Actor Build?` ,
67+ providedConfirmFromStdin : yes || undefined ,
68+ } ) ;
69+ }
5470
5571 if ( ! confirmed ) {
5672 info ( {
0 commit comments