Misc fixes

* Updated build scripts to handle gitless environments a little
  better
* PDO shell plugin improvements
* More tests
This commit is contained in:
2021-12-17 12:51:29 +01:00
parent 1eab339347
commit 0f45219747
10 changed files with 165 additions and 8 deletions

View File

@ -10,6 +10,13 @@ class ScriptRunner
private ?string $directory = null;
private bool $quiet;
public function __construct(bool $quiet=false)
{
$this->quiet = $quiet;
}
public function setDirectory(?string $directory)
{
$this->directory = $directory;
@ -22,6 +29,10 @@ class ScriptRunner
public function evaluateDefinedScript(string $name)
{
if (!array_key_exists($name, $this->scripts)) {
printf("error: The script {$name} is not defined\n");
exit(1);
}
$script = $this->scripts[$name];
$this->evaluate($script);
}
@ -44,10 +55,12 @@ class ScriptRunner
$subscript = $this->scripts[$subname];
$this->evaluate($subscript);
} else {
if (posix_isatty(STDOUT)) {
printf("\e[0;33m> \e[0;93m%s\e[0m\n", $script);
} else {
printf("> %s\n", $script);
if (!$this->quiet) {
if (posix_isatty(STDOUT)) {
printf("\e[0;33m> \e[0;93m%s\e[0m\n", $script);
} else {
printf("> %s\n", $script);
}
}
if (str_contains($script, ' ')) {