Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / examples / helloworld.script
index 07d079c98b9f923add6fb9999a15f55f1c555016..fcb1e9ff34d9816e1e74bc4ac0d9756a57f53fd8 100755 (executable)
@@ -1,50 +1,27 @@
-#!/usr/bin/env drush
+<?php
 
 //
 // This example demonstrates how to write a drush
-// "shebang" script.  These scripts start with the
-// line "#!/usr/bin/env drush" or "#!/full/path/to/drush".
+// script.  These scripts are run with the php-script command.
 //
-// See `drush topic docs-scripts` for more information.
-//
-drush_print("Hello world!");
-drush_print();
-drush_print("The arguments to this command were:");
+use Drush\Drush;
+
+$this->output()->writeln("Hello world!");
+$this->output()->writeln("The extra options/arguments to this command were:");
+$this->output()->writeln(print_r($extra, true));
 
-//
-// If called with --everything, use drush_get_arguments
-// to print the commandline arguments.  Note that this
-// call will include 'php-script' (the drush command)
-// and the path to this script.
-//
-if (drush_get_option('everything')) {
-  drush_print("  " . implode("\n  ", drush_get_arguments()));
-}
-//
-// If --everything is not included, then use
-// drush_shift to pull off the arguments one at
-// a time.  drush_shift only returns the user
-// commandline arguments, and does not include
-// the drush command or the path to this script.
-//
-else {
-  while ($arg = drush_shift()) {
-    drush_print('  ' . $arg);
-  }
-}
 
-drush_print();
 
 //
 // We can check which site was bootstrapped via
 // the '@self' alias, which is defined only if
 // there is a bootstrapped site.
 //
-$self_record = drush_sitealias_get_record('@self');
-if (empty($self_record)) {
-  drush_print('No bootstrapped site.');
+$self = Drush::aliasManager()->getSelf();;
+if (empty($self->root())) {
+  $this->output()->writeln('No bootstrapped site.');
 }
 else {
-  drush_print('The following site is bootstrapped:');
-  _drush_sitealias_print_record($self_record);
+  $this->output()->writeln('The following site is bootstrapped:');
+  $this->output()->writeln(print_r($self->legacyRecord(), true));
 }