nur-sery/tbin/test-console.php

136 lines
2.5 KiB
PHP
Executable File

#!/usr/bin/php
<?php
require(__DIR__.'/../vendor/autoload.php');
use nur\sery\output\std\StdMessenger;
$params = [];
$count = count($argv) - 1;
for ($i = 1; $i <= $count; $i++) {
switch ($argv[$i]) {
case "-n":
$params["color"] = false;
break;
case "+n":
$params["color"] = true;
break;
case "-d":
$params["debug"] = true;
break;
case "+d":
$params["debug"] = false;
break;
case "-L":
$i++;
$params["output"] = $argv[$i];
break;
case "-D":
$params["default_level"] = "debug";
$params["debug"] = true;
break;
case "-N":
$params["default_level"] = "normal";
break;
case "-M":
$params["default_level"] = "major";
break;
}
}
$c = new StdMessenger($params);
$c->section("section");
$c->title("title");
$c->desc("desc");
$c->print("print");
$c->action("action");
$c->step("step");
$c->asuccess("action success");
$c->action("action");
$c->step("step");
$c->afailure("action failure");
$c->action("action");
$c->step("step");
$c->adone("action neutral");
$c->action("action");
$c->asuccess("action success");
$c->action("action");
$c->afailure("action failure");
$c->action("action");
$c->adone("action neutral");
$c->action("action0");
$c->action("action1");
$c->action("action2");
$c->asuccess("action2 success");
$c->asuccess("action1 success");
$c->asuccess("action0 success");
$c->action("action");
$c->step("step");
$c->asuccess();
$c->action("action");
$c->step("step");
$c->afailure();
$c->action("action");
$c->step("step");
$c->adone();
$c->action("action");
$c->asuccess();
$c->action("action");
$c->afailure();
$c->action("action");
$c->adone();
$c->action("action0");
$c->action("action1");
$c->action("action2");
$c->asuccess();
$c->asuccess();
$c->asuccess();
$c->info("info");
$c->note("note");
$c->warn("warn");
$c->error("error");
$c->end();
$c->title("title0");
$c->title("title1");
$c->print("print under title1");
$c->end();
$c->print("print under title0");
$c->end();
$c->end(true);
$c->section("multi-line\nsection");
$c->title("multi-line\ntitle");
$c->title("another\ntitle");
$c->print("multi-line\nprint");
$c->info("multi-line\ninfo");
$c->action("multi-line\naction");
$c->asuccess();
$c->action("multi-line\naction");
$c->step("multi-line\nstep");
$c->afailure();
$c->action("multi-line\naction");
$c->step("multi-line\nstep");
$c->asuccess("multi-line\nsuccess");
$c->action("multi-line\naction");
$c->step("multi-line\nstep");
$c->adone("multi-line\ndone");
$c->end(true);