#!/usr/bin/env php
<?php
require_once __DIR__ . '/../bootstrap/client.php';
$usage = 'usage: ' . PHP_EOL .
' ' . basename(__FILE__) . ' <host>' . PHP_EOL;
execute(function () use ($baseUrl, $command, $values) {
throwExceptionIfInvalidNumberOfValuesWasProvided($values, 1);
list($host) = extractValues($values);
throwExceptionIfValueIsInvalid($host, 'host');
$url = $baseUrl;
$lines = $command->get($host, $url);
$repositoriesAvailable = ((is_array($lines) && (count($lines) > 0)));
if ($repositoriesAvailable) {
foreach ($lines as $line) {
$data = json_decode($line);
echo '[name]' . PHP_EOL;
foreach ($data as $repository) {
echo $repository->name . PHP_EOL;
}
}
} else {
echo 'no repository available' . PHP_EOL;
}
}, $usage);
|