File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,12 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
6565 ->setDescription (self ::getDescription ())
6666 ->addArgument ('queue-config ' , [
6767 'help ' => __ ('Queue configuration key ' ),
68+ ])
69+ ->addOption ('yes ' , [
70+ 'short ' => 'y ' ,
71+ 'boolean ' => true ,
72+ 'default ' => false ,
73+ 'help ' => __ ('Yes - skip confirmation prompt ' )
6874 ]);
6975 }
7076
@@ -91,10 +97,25 @@ public function execute(Arguments $args, ConsoleIo $io)
9197 } else {
9298 $ io ->error (__ ('There are no queue configurations ' ));
9399 }
100+ $ this ->displayHelp ($ this ->getOptionParser (), $ args , $ io );
94101
95102 return self ::CODE_ERROR ;
96103 }
97104
105+ if (!$ args ->getOption ('yes ' )) {
106+ $ confirmation = $ io ->askChoice (
107+ __ ('Are you sure you want to purge messages from specified queue? ' ),
108+ [
109+ __ ('yes ' ),
110+ __ ('no ' )
111+ ],
112+ __ ('no ' )
113+ );
114+
115+ if ($ confirmation === __ ('no ' )) {
116+ $ io ->abort (__ ('Aborting ' ));
117+ }
118+ }
98119 try {
99120 $ this ->enqueueClientService ->purgeQueue ($ queueConfig );
100121 $ io ->success (__ ('Queue purged successfully ' ));
You can’t perform that action at this time.
0 commit comments