<?php
namespace nulib\tools;

use nulib\app\cli\Application;
use nulib\ext\yaml;
use nulib\file\SharedFile;
use nulib\output\msg;

class DumpserApp 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());
    }
  }
}{
}
