You are here

function drush_patterns_info in Patterns 7

Same name and namespace in other branches
  1. 6.2 patterns.drush.inc \drush_patterns_info()
  2. 7.2 patterns.drush.inc \drush_patterns_info()

patterns list command callback.

Parameters

mixed int|string $id The pattern id or name of the pattern:

1 string reference to 'drush_patterns_info'
patterns_drush_command in ./patterns.drush.inc
Implements hook_drush_command().

File

./patterns.drush.inc, line 236
Drush Patterns module commands

Code

function drush_patterns_info($id) {
  $pattern = patterns_get_pattern($id);
  if (!$pattern) {
    return drush_set_error(dt("There is no pattern registered with id or name '{$id}'"));
  }
  $info = "";
  $info .= sprintf("  %-18s: %s\n", 'PID', $pattern->pid);
  $info .= sprintf("  %-18s: %s\n", 'Name', $pattern->name);
  $info .= sprintf("  %-18s: %s\n", 'Description', $pattern->description);
  $info .= sprintf("  %-18s: %s\n", 'File', $pattern->file);
  $info .= sprintf("  %-18s: %s\n", 'Status', $pattern->status);
  $info .= sprintf("  %-18s: %s\n", 'Public', $pattern->public);
  $info .= sprintf("  %-18s: %s\n", 'Updated', $pattern->updated);
  $info .= sprintf("  %-18s: %s\n", 'Enabled', $pattern->enabled);
  if (is_array($pattern->pattern['info'])) {
    foreach ($pattern->pattern['info'] as $key => $value) {
      $info .= sprintf("  %-18s: %s\n", ucfirst($key), $value);
    }
  }
  if (is_array($pattern->pattern['modules'])) {
    $info .= sprintf("  %-18s: %s\n", 'Modules', implode(', ', $pattern->pattern['modules']));
  }
  drush_print($info);
}