You are here

function drush_imageapi_optimize_validate in Image Optimize (or ImageAPI Optimize) 7.2

Validation for the imageapi optimize Drush command.

File

./imageapi_optimize.drush.inc, line 47

Code

function drush_imageapi_optimize_validate() {
  $pipeline = drush_get_option('pipeline');
  $pipelines = array();
  foreach (imageapi_optimize_pipelines() as $pipe) {
    $pipelines[$pipe['name']] = $pipe['label'];
  }
  $pipe = imageapi_optimize_pipeline_load($pipeline);
  if (empty($pipe)) {
    $choice = drush_choice($pipelines, 'Enter a number to choose which pipeline to use.', '!value');
    if ($choice !== FALSE) {
      drush_set_option('pipeline', $choice);
    }
    else {
      return drush_set_error('Could not find pipeline with the specified name.');
    }
  }

  // Validate that we were given some file paths, maybe do the filescan and show the continue form?
}