Security update for Core, with self-updated composer
[yaffs-website] / vendor / drush / drush / examples / helloworld.script
1 #!/usr/bin/env drush
2
3 //
4 // This example demonstrates how to write a drush
5 // "shebang" script.  These scripts start with the
6 // line "#!/usr/bin/env drush" or "#!/full/path/to/drush".
7 //
8 // See `drush topic docs-scripts` for more information.
9 //
10 drush_print("Hello world!");
11 drush_print();
12 drush_print("The arguments to this command were:");
13
14 //
15 // If called with --everything, use drush_get_arguments
16 // to print the commandline arguments.  Note that this
17 // call will include 'php-script' (the drush command)
18 // and the path to this script.
19 //
20 if (drush_get_option('everything')) {
21   drush_print("  " . implode("\n  ", drush_get_arguments()));
22 }
23 //
24 // If --everything is not included, then use
25 // drush_shift to pull off the arguments one at
26 // a time.  drush_shift only returns the user
27 // commandline arguments, and does not include
28 // the drush command or the path to this script.
29 //
30 else {
31   while ($arg = drush_shift()) {
32     drush_print('  ' . $arg);
33   }
34 }
35
36 drush_print();
37
38 //
39 // We can check which site was bootstrapped via
40 // the '@self' alias, which is defined only if
41 // there is a bootstrapped site.
42 //
43 $self_record = drush_sitealias_get_record('@self');
44 if (empty($self_record)) {
45   drush_print('No bootstrapped site.');
46 }
47 else {
48   drush_print('The following site is bootstrapped:');
49   _drush_sitealias_print_record($self_record);
50 }