@@ -64,7 +64,7 @@ protected function configure()
64
64
new InputArgument ('class ' , InputArgument::OPTIONAL , 'The form type class ' ),
65
65
new InputArgument ('option ' , InputArgument::OPTIONAL , 'The form type option ' ),
66
66
new InputOption ('show-deprecated ' , null , InputOption::VALUE_NONE , 'Display deprecated options in form types ' ),
67
- new InputOption ('format ' , null , InputOption::VALUE_REQUIRED , 'The output format (txt or json) ' , 'txt ' ),
67
+ new InputOption ('format ' , null , InputOption::VALUE_REQUIRED , sprintf ( 'The output format ("%s") ' , implode ( ' ", " ' , $ this -> getAvailableFormatOptions ())) , 'txt ' ),
68
68
])
69
69
->setHelp (<<<'EOF'
70
70
The <info>%command.name%</info> command displays information about form types.
@@ -261,8 +261,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
261
261
}
262
262
263
263
if ($ input ->mustSuggestOptionValuesFor ('format ' )) {
264
- $ helper = new DescriptorHelper ();
265
- $ suggestions ->suggestValues ($ helper ->getFormats ());
264
+ $ suggestions ->suggestValues ($ this ->getAvailableFormatOptions ());
266
265
}
267
266
}
268
267
@@ -283,4 +282,9 @@ private function completeOptions(string $class, CompletionSuggestions $suggestio
283
282
$ resolvedType = $ this ->formRegistry ->getType ($ class );
284
283
$ suggestions ->suggestValues ($ resolvedType ->getOptionsResolver ()->getDefinedOptions ());
285
284
}
285
+
286
+ private function getAvailableFormatOptions (): array
287
+ {
288
+ return (new DescriptorHelper ())->getFormats ();
289
+ }
286
290
}
0 commit comments