modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2025-10-15 12:15:04 +04:00
parent 55728059cf
commit 48d5f84bbd
2 changed files with 70 additions and 0 deletions

14
php/tbin/steam-train.php Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/php
<?php
require __DIR__.'/../vendor/autoload.php';
use cli\_SteamTrainApp;
class SteamTrainApp extends _SteamTrainApp {
const PROJDIR = __DIR__;
const VENDOR = [
"autoload" => "../vendor/autoload.php",
"bindir" => "../vendor/bin",
];
}
SteamTrainApp::run();

56
php/tbin/test-output1.php Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/php
<?php
require __DIR__.'/../vendor/autoload.php';
use nulib\app\cli\Application;
use nulib\output\con;
use nulib\output\IMessenger;
use nulib\output\log;
use nulib\output\say;
use nulib\output\std\LogMessenger;
use nulib\output\std\ProxyMessenger;
Application::run(new class extends Application {
const PROJDIR = __DIR__;
const MSG = 0, CON = 1, LOG = 2;
const ARGS = [
"merge" => parent::ARGS,
["-c", "--con", "name" => "use", "value" => self::CON],
["-l", "--log", "name" => "use", "value" => self::LOG],
["-m", "--msg", "name" => "use", "value" => self::MSG],
];
protected int $use = self::MSG;
function main() {
switch ($this->use) {
case self::MSG:
$msg = new ProxyMessenger();
$msg->addMessenger(con::get());
$msg->addMessenger(new LogMessenger());
break;
case self::CON:
$msg = con::get();
break;
case self::LOG:
$msg = new LogMessenger();
break;
}
$msg->info("test d'information");
$msg->action("attente de 2 secondes", function (IMessenger $msg) {
sleep(1);
$msg->asuccess("1 seconde");
sleep(1);
$msg->asuccess("1 seconde");
});
$msg->action("attente de 2 secondes", function (IMessenger $msg) {
sleep(1);
$msg->info("1 seconde");
sleep(1);
$msg->info("1 seconde");
});
$msg->info("fin de test-appctl");
}
});