Pull merge.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / other / drush-command.twig
1 <?php
2
3 /**
4  * @file
5  * Contains {{ command_name }} drush command.
6  */
7
8 /**
9  * Implements hook_drush_help().
10  */
11 function {{ command_file_prefix|h2u }}_drush_help($section) {
12   switch ($section) {
13     case 'drush:{{ command_name }}':
14       $help = dt('Help text here.');
15       return $help;
16   }
17 }
18
19 /**
20  * Implements hook_drush_command().
21  */
22 function {{ command_file_prefix|h2u }}_drush_command() {
23
24   $items['{{ command_name }}'] = [
25     'description' => '{{ description }}',
26     'arguments' => [
27       '{{ argument }}' => 'Argument description',
28     ],
29     'required-arguments' => TRUE,
30     'options' => [
31       '{{ option }}' => 'Option description',
32     ],
33     'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
34     'aliases' => ['{{ alias }}'],
35     'examples' => [
36       'drush {{ alias }} {{ argument }} --{{ option }}' => 'It does something with this argument',
37     ],
38   ];
39
40   return $items;
41 }
42
43 /**
44  * Callback function for {{ command_name }} command.
45  */
46 function drush_{{ command_callback_suffix|h2u }}($argument) {
47
48   $option = drush_get_option('{{ option }}', 'default');
49   drush_print(dt('Argument value is "@argument".', ['@argument' => $argument]));
50   drush_print(dt('Option value is "@option".', ['@option' => $option]));
51
52   drush_set_error(dt('Error text here.'));
53   drush_log(dt('Log text here'));
54
55 }