function drush_sandwich_sandwiches_served

8.0.x sandwich.drush.inc drush_sandwich_sandwiches_served()
6.x sandwich.drush.inc drush_sandwich_sandwiches_served()
7.x sandwich.drush.inc drush_sandwich_sandwiches_served()
master sandwich.drush.inc drush_sandwich_sandwiches_served()

Implementation of hook_drush_command() for sandwiches-served command.

Demonstrates how to return a simple value that is transformed by the selected formatter to display either with a label (using the key-value formatter) or as the raw value itself (using the string formatter).

1 call to drush_sandwich_sandwiches_served()
drush_sandwich_make_me_a_sandwich in examples/sandwich.drush.inc
Example drush command callback. This is where the action takes place.

File

examples/sandwich.drush.inc, line 252
Example drush command.

Code

function drush_sandwich_sandwiches_served() {
  $served = 0;
  $served_object = drush_cache_get(drush_get_cid('sandwiches-served'));
  if ($served_object) {
    $served = $served_object->data;
  }
  // In the default format, key-value, this return value
  // will print " Sandwiches Served    :  1".  In the default pipe
  // format, only the array value ("1") is returned.
  return $served;
}