Yaffs site version 1.1
[yaffs-website] / vendor / drush / drush / commands / core / shellalias.drush.inc
1 <?php
2
3 /**
4  * @file
5  *   Shell alias commands. @see example.drushrc.php for details.
6  */
7
8 function shellalias_drush_help($section) {
9   switch ($section) {
10     case 'drush:shell-alias':
11       return dt('Print a shell alias record.');
12   }
13 }
14
15 /**
16  * Command argument complete callback.
17  *
18  * @return
19  *  Array of available site aliases.
20  */
21 function shellalias_shell_alias_complete() {
22   if ($all = drush_get_context('shell-aliases', array())) {
23     return array('values' => array_keys($all));
24   }
25 }
26
27 function shellalias_drush_command() {
28   $items = array();
29
30   $items['shell-alias'] = array(
31     'description' => 'Print all known shell alias records.',
32     'bootstrap' => DRUSH_BOOTSTRAP_NONE,
33     'arguments' => array(
34       'alias' => 'Shell alias to print',
35     ),
36     'outputformat' => array(
37       'default' => 'key-value',
38       'pipe-format' => 'json',
39       'simplify-single' => TRUE,
40       'output-data-type' => 'format-list',
41     ),
42     'aliases' => array('sha'),
43     'examples' => array(
44       'drush shell-alias' => 'List all alias records known to drush.',
45       'drush shell-alias pull' => 'Print the value of the shell alias \'pull\'.',
46     ),
47   );
48   return $items;
49 }
50
51 /**
52  * Print out the specified shell aliases.
53  */
54 function drush_core_shell_alias($alias = FALSE) {
55   $shell_aliases = drush_get_context('shell-aliases', array());
56   if (!$alias) {
57     return $shell_aliases;
58   }
59   elseif (isset($shell_aliases[$alias])) {
60     return array($alias => $shell_aliases[$alias]);
61   }
62 }