6308c765c8321531ad9eff7e1ff7ce0ad8bfb4da
[yaffs-website] / vendor / drush / drush / docs / context.md
1 Drush Contexts
2 ==============
3
4 The drush contexts API acts as a storage mechanism for all options, arguments and configuration settings that are loaded into drush.
5
6 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.
7
8 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.
9
10 This API defines several contexts that are used by default.
11
12 Argument contexts
13 -----------------
14
15 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().
16
17 -   command : The drush command being executed.
18 -   arguments : Any additional arguments that were specified.
19
20 Setting contexts
21 ----------------
22
23 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.
24
25 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.
26
27 Drush commands may also choose to save settings for a specific context to the matching configuration file through the drush\_save\_config() function.
28
29 Available Setting contexts
30 --------------------------
31
32 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.
33
34 Specified by the script itself :
35
36 -   process : Generated in the current process.
37 -   cli : Passed as --option=value to the command line.
38 -   stdin : Passed as a JSON encoded string through stdin.
39 -   alias : Defined in an alias record, and set in the alias context whenever that alias is used.
40 -   specific : Defined in a command-specific option record, and set in the command context whenever that command is used.
41
42 Specified by config files :
43
44 -   custom : Loaded from the config file specified by --config or -c
45 -   site : Loaded from the drushrc.php file in the Drupal site directory.
46 -   drupal : Loaded from the drushrc.php file in the Drupal root directory.
47 -   user : Loaded from the drushrc.php file in the user's home directory.
48 -   drush : Loaded from the drushrc.php file in the $HOME/.drush directory.
49 -   system : Loaded from the drushrc.php file in the system's $PREFIX/etc/drush directory.
50 -   drush : Loaded from the drushrc.php file in the same directory as drush.php.
51
52 Specified by the script, but has the lowest priority :
53
54 -   default : The script might provide some sensible defaults during init.
55