shellalias.drush.inc

  1. 8.0.x commands/core/shellalias.drush.inc
  2. 6.x commands/core/shellalias.drush.inc
  3. 7.x commands/core/shellalias.drush.inc
  4. 5.x commands/core/shellalias.drush.inc

Shell alias commands.

See also

example.drushrc.php for details.

Functions

Namesort descending Description
drush_core_shell_alias Print out the specified shell aliases.
shellalias_drush_command
shellalias_drush_help
shellalias_shell_alias_complete Command argument complete callback.

File

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