You are here

function drush_apps_list in Apps 7

Get a list of all apps available.

File

./apps.drush.inc, line 76
Apps module drush integration.

Code

function drush_apps_list() {
  $servers = func_get_args();
  module_load_include('inc', 'apps', 'apps.manifest');
  $servers = !empty($servers) ? $servers : array_keys(apps_servers());
  $rows = array(
    array(
      dt('Key'),
      dt('Name'),
      dt('version'),
      dt('server'),
      dt('status'),
    ),
  );
  foreach ($servers as $server) {
    $apps = apps_apps($server);
    foreach ($apps as $k => $app) {
      $status = '';
      switch ($app['status']) {
        case APPS_INCOMPATIBLE:
          $status = 'Incompatible';
          break;
        case APPS_DISABLED:
          $status = 'Disabled';
          break;
        case APPS_ENABLED:
          $status = 'Enabled';
          break;
        case APPS_INSTALLABLE:
          $status = 'Installable';
          break;
      }
      $rows[] = array(
        $k,
        $app['name'],
        $app['version'],
        $server,
        $status,
      );
    }
    unset($apps);
  }
  drush_print_table($rows, TRUE);
}