2 namespace Drupal\woot\Commands;
4 use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
7 * Commandfiles must be listed in a module's drush.services.yml file.
17 public function woot()
23 * This is the my-cat command
25 * This command will concatenate two parameters. If the --flip flag
26 * is provided, then the result is the concatination of two and one.
29 * @param string $one The first parameter.
30 * @param string $two The other parameter.
31 * @option boolean $flip Whether or not the second parameter should come first in the result.
33 * @usage bet alpha --flip
34 * Concatinate "alpha" and "bet".
36 public function myCat($one, $two = '', $options = ['flip' => false])
38 if ($options['flip']) {
39 return "{$two}{$one}";
41 return "{$one}{$two}";
45 * Demonstrate formatters. Default format is 'table'.
47 * @command try:formatters
52 * @usage try:formatters --format=yaml
54 * @usage try:formatters --format=csv
56 * @usage try:formatters --fields=first,third
58 * @usage try:formatters --fields=III,II
60 * @aliases try-formatters
61 * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields
63 public function tryFormatters($options = ['format' => 'table', 'fields' => ''])
66 'en' => [ 'first' => 'One', 'second' => 'Two', 'third' => 'Three' ],
67 'de' => [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei' ],
68 'jp' => [ 'first' => 'Ichi', 'second' => 'Ni', 'third' => 'San' ],
69 'es' => [ 'first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres' ],
71 return new RowsOfFields($outputData);
75 * This command info is altered.
77 * @command woot:altered
78 * @aliases woot-initial-alias
80 public function wootAltered()