nur-sery/tbin/test-console.php

85 lines
1.5 KiB
PHP
Executable File

#!/usr/bin/php
<?php
require(__DIR__.'/../vendor/autoload.php');
use nur\sery\output\Console;
$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 "-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 Console($params);
$c->section("section");
$c->title("title");
$c->desc("desc");
$c->print("print");
$c->action("action");
$c->step("step");
$c->success("action success");
$c->action("action");
$c->step("step");
$c->failure("action failure");
$c->action("action");
$c->success("action success");
$c->action("action");
$c->failure("action failure");
$c->action("action0");
$c->action("action1");
$c->action("action2");
$c->success("action2 success");
$c->success("action1 success");
$c->success("action0 success");
$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->end(true);