forked from drush-ops/drush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helloworld.script
executable file
·50 lines (46 loc) · 1.32 KB
/
helloworld.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/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);
}