1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/usr/bin/env drush
- //
- // 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".
- //
- // See `drush topic docs-scripts` for more information.
- //
- drush_print("Hello world!");
- drush_print();
- drush_print("The arguments to this command were:");
- //
- // 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.');
- }
- else {
- drush_print('The following site is bootstrapped:');
- _drush_sitealias_print_record($self_record);
- }
|