2 namespace Drupal\woot\Commands;
4 use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
7 * For commands that are parts of modules, Drush expects to find commandfiles in
8 * __MODULE__/src/Command, and the namespace is Drupal/__MODULE__/Command.
17 public function woot()
23 * This is the my-cat command
25 * This command will concatinate two parameters. If the --flip flag
26 * is provided, then the result is the concatination of two and one.
28 * @param string $one The first parameter.
29 * @param string $two The other parameter.
30 * @option boolean $flip Whether or not the second parameter should come first in the result.
32 * @usage bet alpha --flip
33 * Concatinate "alpha" and "bet".
35 public function myCat($one, $two = '', $options = ['flip' => false])
37 if ($options['flip']) {
38 return "{$two}{$one}";
40 return "{$one}{$two}";
44 * Demonstrate formatters. Default format is 'table'.
50 * @usage try:formatters --format=yaml
51 * @usage try:formatters --format=csv
52 * @usage try:formatters --fields=first,third
53 * @usage try:formatters --fields=III,II
54 * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields
56 public function tryFormatters($options = ['format' => 'table', 'fields' => ''])
59 'en' => [ 'first' => 'One', 'second' => 'Two', 'third' => 'Three' ],
60 'de' => [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei' ],
61 'jp' => [ 'first' => 'Ichi', 'second' => 'Ni', 'third' => 'San' ],
62 'es' => [ 'first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres' ],
64 return new RowsOfFields($outputData);