#!/usr/bin/php
<?php
require $_composer_autoload_path?? __DIR__.'/../vendor/autoload.php';

use nur\b\io\CacheFile;
use nur\b\io\SharedFile;
use nur\cli\Application;
use nur\msg;
use nur\path;
use nur\yaml;

Application::run(new class extends Application {
  const ARGS = [
    "merge" => parent::ARGS,
    "purpose" => "afficher des données sérialisées",
  ];

  protected $args;

  function main() {
    $files = [];
    foreach ($this->args as $arg) {
      if (is_file($arg)) {
        $files[] = $arg;
      } else {
        msg::warning("$arg: fichier invalide ou introuvable");
      }
    }
    $showSection = count($files) > 1;
    foreach ($files as $file) {
      if ($showSection) msg::section($file);
      $sfile = new SharedFile($file);
      yaml::dump($sfile->unserialize());
    }
  }
});