You are here

patch_manager.drush.inc in Patch manager 7

Same filename and directory in other branches
  1. 6 patch_manager.drush.inc

Provide Drush integration to the patch manager

File

patch_manager.drush.inc
View source
<?php

/**
 * @file
 * Provide Drush integration to the patch manager
 */

/**
 * Implements hook_drush_command().
 */
function patch_manager_drush_command() {
  $items = array();
  $items['patch-list'] = array(
    'callback' => 'patch_manager_command_list',
    'description' => 'List all patches that patch manager knows about.',
    'arguments' => array(),
    'aliases' => array(),
    'options' => array(),
    'examples' => array(),
  );
  return $items;
}

/**
 * Implements hook_drush_help().
 */
function patch_manager_drush_help($section) {
  switch ($section) {
    case 'drush:pm-list':
      return dt('List all patches that patch manager knows about.');
  }
}

/**
 * Patch manager command: list patches
 */
function patch_manager_command_list() {
  $res = db_query('SELECT nid, title FROM {node} WHERE type = :type', array(
    ':type' => "patch",
  ));
  $rows = array();
  while ($node = db_fetch_object($res)) {
    $rows[] = array(
      $node->nid,
      $node->title,
    );
  }
  $header = array(
    t('#'),
    t('Title'),
  );
  $tbl = new Console_Table(CONSOLE_TABLE_ALIGN_LEFT, '');
  $out = $tbl
    ->fromArray($header, $rows);
  drush_print($out);
}

Functions

Namesort descending Description
patch_manager_command_list Patch manager command: list patches
patch_manager_drush_command Implements hook_drush_command().
patch_manager_drush_help Implements hook_drush_help().