run(..) now returns the task result

This commit is contained in:
Pavel Shevaev 2023-11-17 12:32:57 +03:00
parent f1a3b0c35b
commit e9f55092be
3 changed files with 7 additions and 162 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
tags

160
tags
View File

@ -1,160 +0,0 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
TASKMAN_CURRENT_TASK taskman.inc.php /^ $TASKMAN_CURRENT_TASK = $this;$/;" v
TASKMAN_LOG_LEVEL taskman.inc.php /^ $TASKMAN_LOG_LEVEL = -1;$/;" v
TASKMAN_LOG_LEVEL taskman.inc.php /^ $TASKMAN_LOG_LEVEL = 0;$/;" v
TASKMAN_LOG_LEVEL taskman.inc.php /^ $TASKMAN_LOG_LEVEL = 2;$/;" v
TASKMAN_NO_DEPS taskman.inc.php /^ $TASKMAN_NO_DEPS = true;$/;" v
TASKMAN_TASKS taskman.inc.php /^ $TASKMAN_TASKS = array();$/;" v
TASKMAN_TASK_ALIASES taskman.inc.php /^ $TASKMAN_TASK_ALIASES = array();$/;" v
TaskmanException taskman.inc.php /^class TaskmanException extends Exception$/;" c
TaskmanTask taskman.inc.php /^class TaskmanTask$/;" c
_ taskman.inc.php /^function _($str) $/;" f
__construct taskman.inc.php /^ function __construct(\\Closure $func, $name, $props = array())$/;" f
_collectRelatedTasks taskman.inc.php /^ private function _collectRelatedTasks($prop_name)$/;" f
_collect_tasks taskman.inc.php /^function _collect_tasks()$/;" f
_getAfterDeps taskman.inc.php /^ private function _getAfterDeps()$/;" f
_getBeforeDeps taskman.inc.php /^ private function _getBeforeDeps()$/;" f
_getDeps taskman.inc.php /^ private function _getDeps()$/;" f
_get_hints taskman.inc.php /^function _get_hints($task)$/;" f
_get_task_candidates taskman.inc.php /^function _get_task_candidates()$/;" f
_isset_task taskman.inc.php /^function _isset_task($task)$/;" f
_log taskman.inc.php /^function _log($msg, $level = 1)$/;" f
_parse_taskstr taskman.inc.php /^function _parse_taskstr($str)$/;" f
_process_argv taskman.inc.php /^function _process_argv(&$argv)$/;" f
_resolve_callable_prop taskman.inc.php /^function _resolve_callable_prop($name)$/;" f
_taskman_default_logger taskman.inc.php /^function _taskman_default_logger($msg)$/;" f
_taskman_default_usage taskman.inc.php /^function _taskman_default_usage($script_name = "<taskman-script>")$/;" f
alias taskman.inc.php /^ $alias = $this->getPropOr("alias", "");$/;" v
all taskman.inc.php /^ $all = get_tasks();$/;" v
always_tasks taskman.inc.php /^ $always_tasks = array();$/;" v
args taskman.inc.php /^ $args = null;$/;" v
args taskman.inc.php /^ $this->args = $args;$/;" v
args taskman.inc.php /^ $args = func_get_args();$/;" v
args taskman.inc.php /^ private $args = array();$/;" v
args taskman.inc.php /^function run($task, array $args = array())$/;" v
args taskman.inc.php /^function run_many($tasks, $args = array())$/;" v
args_str taskman.inc.php /^ $args_str = serialize($args);$/;" v
argv taskman.inc.php /^ $argv = $filtered;$/;" v
arr taskman.inc.php /^ $arr = array();$/;" v
bench taskman.inc.php /^ $bench = microtime(true);$/;" v
cands taskman.inc.php /^ $cands = _get_task_candidates();$/;" v
cands taskman.inc.php /^ $cands = array();$/;" v
current_task taskman.inc.php /^function current_task()$/;" f
def_name taskman.inc.php /^ $def_name = $v;$/;" v
def_name taskman.inc.php /^ $def_name = substr($v, 0, $eq_pos);$/;" v
def_name taskman.inc.php /^ msg_sys("Setting prop $def_name=" . (is_bool($def_value) ? ($def_value ? 'true' : 'false') : $def_value) . "\\n");$/;" v
def_value taskman.inc.php /^ $def_value = false;$/;" v
def_value taskman.inc.php /^ $def_value = true;$/;" v
def_value taskman.inc.php /^ $def_value = 1;$/;" v
def_value taskman.inc.php /^ $def_value = substr($v, $eq_pos+1);$/;" v
default_task taskman.inc.php /^ $default_task = $task_obj;$/;" v
default_task taskman.inc.php /^ $default_task = null;$/;" v
del taskman.inc.php /^function del($name)$/;" f
deps taskman.inc.php /^ $deps = $this->getPropOr('deps', "");$/;" v
eq_pos taskman.inc.php /^ $eq_pos = strpos($v, '=');$/;" v
error_handler taskman.inc.php /^ $error_handler = $GLOBALS['TASKMAN_ERROR_HANDLER'];$/;" v
extractName taskman.inc.php /^ static function extractName($func)$/;" f
file taskman.inc.php /^ $file = $task->getFile();$/;" v
file taskman.inc.php /^ $this->file = $refl->getFileName();$/;" v
file taskman.inc.php /^ private $file;$/;" v
filter taskman.inc.php /^ $filter = $args[0];$/;" v
filter taskman.inc.php /^ $filter = '';$/;" v
filtered taskman.inc.php /^ $filtered = array();$/;" v
found taskman.inc.php /^ $found = array_filter($tasks, function($v) use($task) { return strpos($v, $task) === 0; });$/;" v
found taskman.inc.php /^ $found = array_merge($found, array_filter($tasks, function($v) use($task) { $pos = strpos($v, $task); return $pos !== false && $pos > 0; }));$/;" v
func taskman.inc.php /^ $func = $args[1];$/;" v
func taskman.inc.php /^ $func = $args[2];$/;" v
func taskman.inc.php /^ $this->func = $func;$/;" v
func taskman.inc.php /^ private $func;$/;" v
get taskman.inc.php /^function get($name)$/;" f
getAliases taskman.inc.php /^ function getAliases()$/;" f
getArgs taskman.inc.php /^ function getArgs()$/;" f
getFile taskman.inc.php /^ function getFile()$/;" f
getFunc taskman.inc.php /^ function getFunc()$/;" f
getLine taskman.inc.php /^ function getLine()$/;" f
getName taskman.inc.php /^ function getName()$/;" f
getProp taskman.inc.php /^ function getProp($name)$/;" f
getPropOr taskman.inc.php /^ function getPropOr($name, $def)$/;" f
getProps taskman.inc.php /^ function getProps()$/;" f
get_task taskman.inc.php /^function get_task($task)$/;" f
get_tasks taskman.inc.php /^function get_tasks()$/;" f
getor taskman.inc.php /^function getor($name, $def)$/;" f
hasProp taskman.inc.php /^ function hasProp($name)$/;" f
has_run taskman.inc.php /^ private $has_run = array();$/;" v
help_func taskman.inc.php /^ $help_func = $GLOBALS['TASKMAN_HELP_FUNC'];$/;" v
help_func taskman.inc.php /^function main($argv = array(), $help_func = null, $proc_argv = true)$/;" v
hints taskman.inc.php /^ $hints = _get_hints($pattern);$/;" v
is taskman.inc.php /^function is($name)$/;" f
is_running taskman.inc.php /^ $this->is_running = false;$/;" v
is_running taskman.inc.php /^ $this->is_running = true;$/;" v
is_running taskman.inc.php /^ private $is_running = false;$/;" v
is_similar taskman.inc.php /^ $is_similar = false;$/;" v
is_similar taskman.inc.php /^ $is_similar = true;$/;" v
items taskman.inc.php /^ $items = explode(',', $str);$/;" v
k taskman.inc.php /^ foreach($props as $k => $v)$/;" v
key taskman.inc.php /^ foreach($GLOBALS as $key => $value)$/;" v
level taskman.inc.php /^ $level = count($TASKMAN_STACK)-1; $/;" v
level taskman.inc.php /^function _log($msg, $level = 1)$/;" v
line taskman.inc.php /^ $line = $task->getLine();$/;" v
line taskman.inc.php /^ $this->line = $refl->getStartLine();$/;" v
line taskman.inc.php /^ private $line;$/;" v
logger taskman.inc.php /^ $logger = $GLOBALS['TASKMAN_LOGGER'];$/;" v
main taskman.inc.php /^function main($argv = array(), $help_func = null, $proc_argv = true)$/;" f
maxlen taskman.inc.php /^ $maxlen = strlen($task->getName());$/;" v
maxlen taskman.inc.php /^ $maxlen = -1;$/;" v
msg taskman.inc.php /^function msg($msg)$/;" f
msg_dbg taskman.inc.php /^function msg_dbg($msg)$/;" f
msg_sys taskman.inc.php /^function msg_sys($msg)$/;" f
name taskman.inc.php /^ $name = substr($key, strlen('TASKMAN_PROP_'));$/;" v
name taskman.inc.php /^ $this->name = $name;$/;" v
name taskman.inc.php /^ foreach($task->getProps() as $name => $value)$/;" v
name taskman.inc.php /^ foreach($TASKMAN_CLOSURES as $name => $args)$/;" v
name taskman.inc.php /^ foreach($cands as $name => $args)$/;" v
name taskman.inc.php /^ private $name;$/;" v
pad taskman.inc.php /^ $pad = $maxlen + 1;$/;" v
pad taskman.inc.php /^ $pad = $maxlen - strlen($task->getName());$/;" v
pattern taskman.inc.php /^ $pattern = substr($pattern, 0, strlen($pattern) - 1);$/;" v
pattern taskman.inc.php /^ $pattern = substr($pattern, 1, strlen($pattern) - 1);$/;" v
pattern taskman.inc.php /^ $pattern = $tasks[0];$/;" v
process_defs taskman.inc.php /^ $process_defs = false;$/;" v
process_defs taskman.inc.php /^ $process_defs = true;$/;" v
process_defs taskman.inc.php /^ $process_defs = false;$/;" v
prop taskman.inc.php /^ $prop = $GLOBALS['TASKMAN_PROP_' . $name];$/;" v
props taskman.inc.php /^ $props = $args[1];$/;" v
props taskman.inc.php /^ $props = array();$/;" v
props taskman.inc.php /^ $this->props = $props;$/;" v
props taskman.inc.php /^ $props = array();$/;" v
props taskman.inc.php /^ $props = props();$/;" v
props taskman.inc.php /^ function __construct(\\Closure $func, $name, $props = array())$/;" v
props taskman.inc.php /^ private $props = array();$/;" v
props taskman.inc.php /^function props()$/;" f
props_string taskman.inc.php /^ $props_string = '';$/;" v
props_string taskman.inc.php /^ $props_string = rtrim($props_string);$/;" v
refl taskman.inc.php /^ $refl = new \\ReflectionFunction($func);$/;" v
run taskman.inc.php /^ function run($args = array())$/;" f
run taskman.inc.php /^function run($task, array $args = array())$/;" f
run_many taskman.inc.php /^function run_many($tasks, $args = array())$/;" f
set taskman.inc.php /^function set($name, $value)$/;" f
setor taskman.inc.php /^function setor($name, $value)$/;" f
str taskman.inc.php /^ $str = preg_replace_callback($/;" v
task taskman.inc.php /^ $task = new TaskmanTask($func, $name, $props);$/;" v
task taskman.inc.php /^ $task = $item;$/;" v
task taskman.inc.php /^function task($name)$/;" f
task_obj taskman.inc.php /^ $task_obj = $task;$/;" v
task_obj taskman.inc.php /^ $task_obj = get_task($task);$/;" v
task_spec taskman.inc.php /^ $task_spec = array();$/;" v
task_str taskman.inc.php /^ $task_str = array_shift($argv);$/;" v
tasks taskman.inc.php /^ $tasks = $hints;$/;" v
tasks taskman.inc.php /^ $tasks = _parse_taskstr($task_str);$/;" v
tasks taskman.inc.php /^ $tasks = array();$/;" v
tasks taskman.inc.php /^ $tasks = array_merge(array_keys($TASKMAN_TASKS), array_keys($TASKMAN_TASK_ALIASES));$/;" v
usage taskman.inc.php /^function usage($script_name = "<taskman-script>")$/;" f
v taskman.inc.php /^ $v = $argv[$i];$/;" v
validate taskman.inc.php /^ function validate()$/;" f
value taskman.inc.php /^ $value = $task_obj->getPropOr($prop_name, "");$/;" v
value taskman.inc.php /^ $value = $prop();$/;" v

View File

@ -131,6 +131,8 @@ class TaskmanTask
$this->is_running = true; $this->is_running = true;
$this->args = $args; $this->args = $args;
$task_result = null;
try try
{ {
$TASKMAN_STACK[] = $this; $TASKMAN_STACK[] = $this;
@ -149,7 +151,7 @@ class TaskmanTask
$bench = microtime(true); $bench = microtime(true);
call_user_func_array($this->func, array($this->args)); $task_result = 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)
@ -169,6 +171,8 @@ class TaskmanTask
else else
throw $e; throw $e;
} }
return $task_result;
} }
private function _getBeforeDeps() private function _getBeforeDeps()
@ -402,7 +406,7 @@ function run($task, array $args = array())
else else
$task_obj = get_task($task); $task_obj = get_task($task);
$task_obj->run($args); return $task_obj->run($args);
} }
function run_many($tasks, $args = array()) function run_many($tasks, $args = array())