use Consolidation\AnnotatedCommand\CommandData;
use Consolidation\AnnotatedCommand\Events\CustomEventAwareInterface;
use Consolidation\AnnotatedCommand\Events\CustomEventAwareTrait;
+use Symfony\Component\Console\Command\Command;
+
+use Consolidation\TestUtils\ExampleCommandFile as ExampleAliasedClass;
/**
* Test file used in the testCommandDiscovery() test.
return new CommandError('This command always fails.', 13);
}
+ public static function ignoredStaticMethod()
+ {
+ return 'This method is static; it should not generate a command.';
+ }
+
/**
* @command simulated:status
*/
* Note that either the field ID or the visible field label may be used.
* @aliases extab
* @topics docs-tables
- * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields
+ * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields Fully-qualified class name
*/
public function exampleTable($unused = '', $options = ['format' => 'table', 'fields' => ''])
{
return new RowsOfFields($outputData);
}
+ /**
+ * Test command with formatters using a short classname in @return
+ *
+ * @command example:table2
+ * @param $unused An unused argument
+ * @field-labels
+ * first: I
+ * second: II
+ * third: III
+ * @usage example:table --format=yml
+ * Show the example table in yml format.
+ * @usage example:table --fields=first,third
+ * Show only the first and third fields in the table.
+ * @usage example:table --fields=II,III
+ * Note that either the field ID or the visible field label may be used.
+ * @aliases extab
+ * @topics docs-tables
+ * @return RowsOfFields Short class names are converted to fqcns
+ */
+ public function exampleTableTwo($unused = '', $options = ['format' => 'table', 'fields' => ''])
+ {
+ $outputData = [
+ [ 'first' => 'One', 'second' => 'Two', 'third' => 'Three' ],
+ [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei' ],
+ [ 'first' => 'Ichi', 'second' => 'Ni', 'third' => 'San' ],
+ [ 'first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres' ],
+ ];
+ return new RowsOfFields($outputData);
+ }
+
/**
* Test word wrapping
*
/**
* @hook option example:table
*/
- public function additionalOptionForExampleTable($command, $annotationData)
+ public function additionalOptionForExampleTable(Command $command, AnnotationData $annotationData)
{
$command->addOption(
'dynamic',