maj dumpser

This commit is contained in:
Jephté Clain 2025-01-29 11:18:45 +04:00
parent b20e7380e7
commit b17cf4ebad
4 changed files with 44 additions and 2 deletions

7
bin/dumpser.php Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/php
<?php
require $_composer_autoload_path?? __DIR__.'/../vendor/autoload.php';
use nulib\tools\DumpserApp;
DumpserApp::run();

View File

@ -80,12 +80,13 @@
}
},
"bin": [
"bin/dumpser.php",
"bin/csv2xlsx.php",
"nur_bin/compctl.php",
"nur_bin/compdep.php",
"nur_bin/datectl.php",
"nur_bin/fsvdiff.php",
"nur_bin/cachectl.php",
"nur_bin/dumpser.php",
"nur_bin/ldap-delete.php",
"nur_bin/ldap-get-infos.php",
"nur_bin/ldap-search.php",

View File

@ -1,2 +1,2 @@
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
__uaddpath "@@dest@@/nur_bin" PATH
__uaddpath "@@dest@@/bin:@@dest@@/nur_bin" PATH

View File

@ -0,0 +1,34 @@
<?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());
}
}
}{
}