/**
 * Extend the Coffee functionality with your own commands and items.
 *
 * Here's an example of how to add content to Coffee.
 */
function hook_coffee_commands()
{
    $commands = array();
    // Basic example, for 1 result.
    $commands[] = array('value' => 'Simple', 'label' => 'node/example', 'command' => ':simple');
    // More advanced example to include a view.
    $view = Drupal::getView();
    if ($view) {
        $view->set_display('default');
        $view->pre_execute();
        $view->execute();
        if (count($view->result) > 0) {
            foreach ($view->result as $row) {
                $commands[] = array('value' => ltrim(url('node/' . $row->nid), '/'), 'label' => Drupal::checkPlain('Pub: ' . $row->node_title), 'command' => ':x');
            }
        }
    }
    return $commands;
}