More structured output

This commit is contained in:
Pavel Shevaev 2023-03-29 23:22:10 +03:00
parent 6bd6a8a4d3
commit b16c83b8c4
1 changed files with 9 additions and 5 deletions

View File

@ -132,25 +132,29 @@ class TaskmanTask
try try
{ {
$TASKMAN_STACK[] = $this;
$level = count($TASKMAN_STACK)-1;
msg_sys("***** ".str_repeat('-', $level)."task '" . $this->getName() . "' start *****\n");
if(!$TASKMAN_NO_DEPS) if(!$TASKMAN_NO_DEPS)
{ {
run_many($this->_getBeforeDeps()); run_many($this->_getBeforeDeps());
run_many($this->_getDeps()); run_many($this->_getDeps());
} }
msg_sys("***** '" . $this->getName() . "' start *****\n"); $TASKMAN_CURRENT_TASK = $this;
$bench = microtime(true); $bench = microtime(true);
$TASKMAN_CURRENT_TASK = $this;
$TASKMAN_STACK[] = $this;
call_user_func_array($this->func, array($this->args)); call_user_func_array($this->func, array($this->args));
array_pop($TASKMAN_STACK); array_pop($TASKMAN_STACK);
if(!$TASKMAN_NO_DEPS) if(!$TASKMAN_NO_DEPS)
run_many($this->_getAfterDeps()); run_many($this->_getAfterDeps());
msg_sys("***** '" . $this->getName() . "' done(" . msg_sys("***** ".str_repeat('-', $level)."task '" . $this->getName() . "' done(" .
round(microtime(true)-$bench,2) . '/' .round(microtime(true)-$TASKMAN_START_TIME,2) . " sec.) *****\n"); round(microtime(true)-$bench,2) . '/' .round(microtime(true)-$TASKMAN_START_TIME,2) . " sec.) *****\n");
$this->has_run[$args_str] = true; $this->has_run[$args_str] = true;
@ -644,7 +648,7 @@ function main($argv = array(), $help_func = null, $proc_argv = true)
else if($default_task) else if($default_task)
$default_task->run($argv); $default_task->run($argv);
msg_sys("**** All done (".round(microtime(true)-$GLOBALS['TASKMAN_START_TIME'],2)." sec.) ****\n"); msg_sys("***** All done (".round(microtime(true)-$GLOBALS['TASKMAN_START_TIME'],2)." sec.) *****\n");
} }
function usage($script_name = "<taskman-script>") function usage($script_name = "<taskman-script>")