php-dataset/bin/dataset-info

31 lines
746 B
Plaintext
Raw Normal View History

2022-10-30 18:38:43 +01:00
#!/usr/bin/env php
<?php
foreach ([
2022-10-30 23:21:53 +01:00
__DIR__."/..",
2022-10-30 18:38:43 +01:00
__DIR__."/../vendor",
2022-10-30 23:21:53 +01:00
__DIR__."/../../..",
2022-10-30 23:02:14 +01:00
__DIR__."/vendor",
2022-10-30 18:38:43 +01:00
] as $dir) {
if (file_exists($dir."/autoload.php")) {
2022-10-30 23:02:14 +01:00
define("COMPOSER_VENDOR_PATH", $dir);
2022-10-30 18:38:43 +01:00
require_once $dir."/autoload.php";
}
}
$datasetManager = new NoccyLabs\Dataset\DatasetManager();
$datasets = $datasetManager->getAvailableDatasets();
foreach ($datasets as $dataset) {
2022-10-30 23:02:14 +01:00
echo $dataset->getIdentifier()." (".$dataset->getVersion().")\n";
$reader = $dataset->open();
$rows = 0;
$headers = null;
foreach ($reader as $row) {
if (!$headers) $headers = array_keys($row);
$rows++;
}
2022-10-31 00:42:29 +01:00
echo " # ".$rows." rows\n - ".join("\n - ",$headers)."\n";
2022-10-30 18:38:43 +01:00
}