forked from drush-ops/drush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontext.html
73 lines (69 loc) · 2.98 KB
/
context.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<h1>Drush Contexts</h1>
<p>
The drush contexts API acts as a storage mechanism for all options,
arguments and configuration settings that are loaded into drush.
<p>
This API also acts as an IPC mechanism between the different drush commands,
and provides protection from accidentally overriding settings that are
needed by other parts of the system.
<p>
It also avoids the necessity to pass references through the command chain
and allows the scripts to keep track of whether any settings have changed
since the previous execution.
<p>
This API defines several contexts that are used by default.
<h2>Argument contexts</h2>
<p>
These contexts are used by Drush to store information on the command.
They have their own access functions in the forms of
drush_set_arguments(), drush_get_arguments(), drush_set_command(),
drush_get_command().
<ul>
<li>command : The drush command being executed.</li>
<li>arguments : Any additional arguments that were specified.</li>
</ul>
<h2>Setting contexts</h2>
<p>
These contexts store options that have been passed to the drush.php
script, either through the use of any of the config files, directly from
the command line through --option='value' or through a JSON encoded string
passed through the STDIN pipe.
<p>
These contexts are accessible through the drush_get_option() and
drush_set_option() functions. See drush_context_names() for a description
of all of the contexts.
<p>
Drush commands may also choose to save settings for a specific context to
the matching configuration file through the drush_save_config() function.
<h2>Available Setting contexts</h2>
<p>
These contexts are evaluated in a certain order, and the highest priority value
is returned by default from drush_get_option. This allows scripts to check whether
an option was different before the current execution.
<p>
Specified by the script itself :
<ul>
<li>process : Generated in the current process.
<li>cli : Passed as --option=value to the command line.
<li>stdin : Passed as a JSON encoded string through stdin.
<li>alias : Defined in an alias record, and set in the
alias context whenever that alias is used.
<li>specific : Defined in a command-specific option record, and
set in the command context whenever that command is used.
</ul>
<p>
Specified by config files :
<ul>
<li>custom : Loaded from the config file specified by --config or -c
<li>site : Loaded from the drushrc.php file in the Drupal site directory.
<li>drupal : Loaded from the drushrc.php file in the Drupal root directory.
<li>user : Loaded from the drushrc.php file in the user's home directory.
<li>drush : Loaded from the drushrc.php file in the $HOME/.drush directory.
<li>system : Loaded from the drushrc.php file in the system's $PREFIX/etc/drush directory.
<li>drush : Loaded from the drushrc.php file in the same directory as drush.php.
</ul>
<p>
Specified by the script, but has the lowest priority :
<ul>
<li>default : The script might provide some sensible defaults during init.
</ul>