Removing deprecated taskman syntax

This commit is contained in:
Pavel Shevaev 2022-06-06 18:36:02 +03:00
parent 84a43f8537
commit a75d24aeb0
1 changed files with 332 additions and 515 deletions

View File

@ -9,12 +9,32 @@ $GLOBALS['TASKMAN_LOG_LEVEL'] = 1; //0 - important, 1 - normal, 2 - debug
$GLOBALS['TASKMAN_NO_DEPS'] = false;
$GLOBALS['TASKMAN_SCRIPT'] = '';
$GLOBALS['TASKMAN_CURRENT_TASK'] = null;
$GLOBALS['TASKMAN_HELP_FUNC'] = 'taskman_default_usage';
$GLOBALS['TASKMAN_HELP_FUNC'] = '_taskman_default_usage';
$GLOBALS['TASKMAN_LOGGER'] = '_taskman_default_logger';
$GLOBALS['TASKMAN_ERROR_HANDLER'] = null;
$GLOBALS['TASKMAN_START_TIME'] = 0;
class TaskmanException extends Exception
function _taskman_default_logger($msg)
{
echo $msg;
}
function _taskman_default_usage($script_name = "<taskman-script>")
{
echo "\nUsage:\n $script_name [OPTIONS] <task-name1>[,<task-name2>,..] [-D PROP1=value [-D PROP2]]\n\n";
echo "Available options:\n";
echo " -c specify PHP script to be included (handy for setting props,config options,etc)\n";
echo " -V be super verbose\n";
echo " -q be quite, only system messages\n";
echo " -b batch mode: be super quite, don't even output any system messages\n";
echo " -- pass all options verbatim after this mark\n";
}
} //namespace global
namespace taskman {
class TaskmanException extends \Exception
{}
class TaskmanTask
@ -28,41 +48,29 @@ class TaskmanTask
private $has_run = array();
private $args = array();
function __construct($func, $name = null, $props = null)
function __construct(\Closure $func, $name, $props = array())
{
if(!is_callable($func))
throw new TaskmanException("Task '{$func}' is non-callable");
$refl = new ReflectionFunction($func);
$this->file = $refl->getFileName();
$this->line = $refl->getStartLine();
if(is_string($func) && $name === null && $props === null)
{
$this->name = self::extractName($func);
$this->_parseProps($refl);
}
else
{
$this->func = $func;
$this->name = $name;
$this->props = $props;
}
$this->func = $func;
}
function validate()
{
try
{
foreach($this->_getBeforeDeps() as $dep_task)
taskman_gettask($dep_task);
get_task($dep_task);
foreach($this->_getDeps() as $dep_task)
taskman_gettask($dep_task);
get_task($dep_task);
foreach($this->_getAfterDeps() as $dep_task)
taskman_gettask($dep_task);
get_task($dep_task);
}
catch(Exception $e)
{
@ -126,11 +134,11 @@ class TaskmanTask
{
if(!$TASKMAN_NO_DEPS)
{
taskman_runtasks($this->_getBeforeDeps());
taskman_runtasks($this->_getDeps());
run_many($this->_getBeforeDeps());
run_many($this->_getDeps());
}
taskman_sysmsg("************************ Running task '" . $this->getName() . "' ************************\n");
msg_sys("************************ Running task '" . $this->getName() . "' ************************\n");
$bench = microtime(true);
@ -140,9 +148,9 @@ class TaskmanTask
array_pop($TASKMAN_STACK);
if(!$TASKMAN_NO_DEPS)
taskman_runtasks($this->_getAfterDeps());
run_many($this->_getAfterDeps());
taskman_sysmsg("************************* '" . $this->getName() . "' done (" .
msg_sys("************************* '" . $this->getName() . "' done (" .
round(microtime(true)-$bench,2) . '/' .round(microtime(true)-$TASKMAN_START_TIME,2) . " sec.)*************************\n");
$this->has_run[$args_str] = true;
@ -171,7 +179,7 @@ class TaskmanTask
private function _collectRelatedTasks($prop_name)
{
$arr = array();
foreach(taskman_gettasks() as $task_obj)
foreach(get_tasks() as $task_obj)
{
if($this->getName() == $task_obj->getName())
continue;
@ -189,7 +197,7 @@ class TaskmanTask
if(is_array($deps))
return $deps;
else if($deps && is_string($deps))
return _taskman_parse_taskstr($deps);
return _parse_taskstr($deps);
return array();
}
@ -231,112 +239,234 @@ class TaskmanTask
}
}
function taskman_reset()
function _collect_tasks()
{
$GLOBALS['TASKMAN_TASKS'] = array();
$GLOBALS['TASKMAN_TASK_ALIASES'] = array();
$GLOBALS['TASKMAN_CURRENT_TASK'] = null;
$GLOBALS['TASKMAN_CONFIG'] = array();
global $TASKMAN_TASKS;
global $TASKMAN_TASK_ALIASES;
_taskman_collecttasks();
$TASKMAN_TASKS = array();
$TASKMAN_TASK_ALIASES = array();
$cands = _get_task_candidates();
foreach($cands as $name => $args)
{
if(isset($TASKMAN_TASKS[$name]))
throw new TaskmanException("Task '$name' is already defined");
if(is_array($args))
{
$props = array();
if(sizeof($args) > 2)
{
$props = $args[1];
$func = $args[2];
}
else
$func = $args[1];
$task = new TaskmanTask($func, $name, $props);
}
else
throw new Exception("Task '$name' is invalid");
$TASKMAN_TASKS[$name] = $task;
foreach($task->getAliases() as $alias)
{
if(isset($TASKMAN_TASKS[$alias]) || isset($TASKMAN_TASK_ALIASES[$alias]))
throw new TaskmanException("Alias '$alias' is already defined for task '$name'");
$TASKMAN_TASK_ALIASES[$alias] = $task;
}
}
function taskman_str($str)
foreach($TASKMAN_TASKS as $task)
$task->validate();
}
function _get_task_candidates()
{
global $TASKMAN_CLOSURES;
$cands = array();
//get tasks defined as closures
foreach($TASKMAN_CLOSURES as $name => $args)
{
if(isset($cands[$name]))
throw new Exception("Task '$name' is already defined");
$cands[$name] = $args;
}
ksort($cands);
return $cands;
}
function get_task($task)
{
global $TASKMAN_TASKS;
global $TASKMAN_TASK_ALIASES;
if(!is_scalar($task))
throw new TaskmanException("Bad task name");
if(isset($TASKMAN_TASKS[$task]))
return $TASKMAN_TASKS[$task];
if(isset($TASKMAN_TASK_ALIASES[$task]))
return $TASKMAN_TASK_ALIASES[$task];
throw new TaskmanException("Task with name/alias '{$task}' does not exist");
}
function _resolve_callable_prop($name)
{
$prop = $GLOBALS['TASKMAN_PROP_' . $name];
if(!($prop instanceof \Closure))
return;
$value = $prop();
$GLOBALS['TASKMAN_PROP_' . $name] = $value;
}
function get($name)
{
if(!isset($GLOBALS['TASKMAN_PROP_' . $name]))
throw new TaskmanException("Property '$name' is not set");
_resolve_callable_prop($name);
return $GLOBALS['TASKMAN_PROP_' . $name];
}
function getor($name, $def)
{
if(!isset($GLOBALS['TASKMAN_PROP_' . $name]))
return $def;
_resolve_callable_prop($name);
return $GLOBALS['TASKMAN_PROP_' . $name];
}
function set($name, $value)
{
$GLOBALS['TASKMAN_PROP_' . $name] = $value;
}
function setor($name, $value)
{
if(!isset($GLOBALS['TASKMAN_PROP_' . $name]))
$GLOBALS['TASKMAN_PROP_' . $name] = $value;
}
function is($name)
{
return isset($GLOBALS['TASKMAN_PROP_' . $name]);
}
function del($name)
{
unset($GLOBALS['TASKMAN_PROP_' . $name]);
}
function props()
{
$props = array();
foreach($GLOBALS as $key => $value)
{
if(($idx = strpos($key, 'TASKMAN_PROP_')) === 0)
{
$name = substr($key, strlen('TASKMAN_PROP_'));
$props[$name] = get($name);
}
}
return $props;
}
function task($name)
{
global $TASKMAN_CLOSURES;
$args = func_get_args();
$TASKMAN_CLOSURES[$name] = $args;
}
function get_tasks()
{
global $TASKMAN_TASKS;
return $TASKMAN_TASKS;
}
function current_task()
{
global $TASKMAN_CURRENT_TASK;
return $TASKMAN_CURRENT_TASK;
}
function run($task, array $args = array())
{
if($task instanceof TaskmanTask)
$task_obj = $task;
else
$task_obj = get_task($task);
$task_obj->run($args);
}
function run_many($tasks, $args = array())
{
foreach($tasks as $task_spec)
{
if(is_array($task_spec))
run($task_spec[0], $task_spec[1]);
else
run($task_spec, $args);
}
}
function msg_dbg($msg)
{
_log($msg, 2);
}
function msg($msg)
{
_log($msg, 1);
}
function msg_sys($msg)
{
_log($msg, 0);
}
function _log($msg, $level = 1)
{
global $TASKMAN_LOG_LEVEL;
if($TASKMAN_LOG_LEVEL < $level)
return;
$logger = $GLOBALS['TASKMAN_LOGGER'];
call_user_func_array($logger, array($msg));
}
function _($str)
{
if(strpos($str, '%') === false)
return $str;
$str = preg_replace_callback(
'~%\(([^\)]+)\)%~',
function($m) { return taskman_prop($m[1]); },
function($m) { return get($m[1]); },
$str
);
return $str;
}
function taskman_run($argv = array(), $help_func = null, $proc_argv = true)
{
$GLOBALS['TASKMAN_START_TIME'] = microtime(true);
if($help_func)
$GLOBALS['TASKMAN_HELP_FUNC'] = $help_func;
if($proc_argv)
taskman_process_argv($argv);
$GLOBALS['TASKMAN_SCRIPT'] = array_shift($argv);
_taskman_collecttasks();
$always_tasks = array();
$default_task = null;
foreach(taskman_gettasks() as $task_obj)
{
if($task_obj->hasProp('always'))
array_unshift($always_tasks, $task_obj);
if($task_obj->hasProp('default'))
{
if($default_task)
throw new TaskmanException("Assigned default task '" . $default_task->getName() . "' conflicts with '" . $task_obj->getName() . "'");
else
$default_task = $task_obj;
}
}
foreach($always_tasks as $always_task)
$always_task->run(array());
if(sizeof($argv) > 0)
{
$task_str = array_shift($argv);
$tasks = _taskman_parse_taskstr($task_str);
if(count($tasks) == 1 && !taskman_isset_task($tasks[0]))
{
$pattern = $tasks[0];
if($pattern[0] == '~')
{
$pattern = substr($pattern, 1, strlen($pattern) - 1);
$is_similar = true;
}
elseif(substr($pattern, -1, 1) == '~')
{
$pattern = substr($pattern, 0, strlen($pattern) - 1);
$is_similar = true;
}
else
$is_similar = false;
$hints = taskman_get_hints($pattern);
if($is_similar && count($hints) == 1)
$tasks = $hints;
else
{
printf("ERROR! Task %s not found\n", $tasks[0]);
if($hints)
{
printf("Similar tasks:\n");
foreach($hints as $hint)
printf(" %s\n", $hint);
}
exit(1);
}
}
taskman_runtasks($tasks, $argv);
}
else if($default_task)
$default_task->run($argv);
taskman_sysmsg("************************ All done (".round(microtime(true)-$GLOBALS['TASKMAN_START_TIME'],2)." sec.)************************\n");
}
function taskman_isset_task($task)
function _isset_task($task)
{
global $TASKMAN_TASKS;
global $TASKMAN_TASK_ALIASES;
return isset($TASKMAN_TASKS[$task]) || isset($TASKMAN_TASK_ALIASES[$task]);
}
function taskman_get_hints($task)
function _get_hints($task)
{
global $TASKMAN_TASKS;
global $TASKMAN_TASK_ALIASES;
@ -346,7 +476,26 @@ function taskman_get_hints($task)
return $found;
}
function taskman_process_argv(&$argv)
function _parse_taskstr($str)
{
$task_spec = array();
$items = explode(',', $str);
foreach($items as $item)
{
$args = null;
$task = $item;
if(strpos($item, ' ') !== false)
@list($task, $args) = explode(' ', $item, 2);
if($args)
$task_spec[] = array($task, explode(' ', $args));
else
$task_spec[] = $task;
}
return $task_spec;
}
function _process_argv(&$argv)
{
global $TASKMAN_LOG_LEVEL;
global $TASKMAN_BATCH;
@ -410,7 +559,7 @@ function taskman_process_argv(&$argv)
$def_value = 1;
}
taskman_sysmsg("Setting prop $def_name=" . (is_bool($def_value) ? ($def_value ? 'true' : 'false') : $def_value) . "\n");
msg_sys("Setting prop $def_name=" . (is_bool($def_value) ? ($def_value ? 'true' : 'false') : $def_value) . "\n");
taskman_propset($def_name, $def_value);
$process_defs = false;
@ -421,317 +570,88 @@ function taskman_process_argv(&$argv)
$argv = $filtered;
}
function _taskman_collecttasks()
{
global $TASKMAN_TASKS;
global $TASKMAN_TASK_ALIASES;
$TASKMAN_TASKS = array();
$TASKMAN_TASK_ALIASES = array();
$cands = _taskman_get_task_candidates();
foreach($cands as $name => $args)
function main($argv = array(), $help_func = null, $proc_argv = true)
{
if(isset($TASKMAN_TASKS[$name]))
throw new TaskmanException("Task '$name' is already defined");
$GLOBALS['TASKMAN_START_TIME'] = microtime(true);
$task = null;
if(is_string($args))
if($help_func)
$GLOBALS['TASKMAN_HELP_FUNC'] = $help_func;
if($proc_argv)
_process_argv($argv);
$GLOBALS['TASKMAN_SCRIPT'] = array_shift($argv);
_collect_tasks();
$always_tasks = array();
$default_task = null;
foreach(get_tasks() as $task_obj)
{
$task = new TaskmanTask($args);
if($task_obj->hasProp('always'))
array_unshift($always_tasks, $task_obj);
if($task_obj->hasProp('default'))
{
if($default_task)
throw new TaskmanException("Assigned default task '" . $default_task->getName() . "' conflicts with '" . $task_obj->getName() . "'");
else
$default_task = $task_obj;
}
else if(is_array($args))
}
foreach($always_tasks as $always_task)
$always_task->run(array());
if(sizeof($argv) > 0)
{
$props = array();
if(sizeof($args) > 2)
$task_str = array_shift($argv);
$tasks = _taskman_parse_taskstr($task_str);
if(count($tasks) == 1 && !_isset_task($tasks[0]))
{
$props = $args[1];
$func = $args[2];
$pattern = $tasks[0];
if($pattern[0] == '~')
{
$pattern = substr($pattern, 1, strlen($pattern) - 1);
$is_similar = true;
}
elseif(substr($pattern, -1, 1) == '~')
{
$pattern = substr($pattern, 0, strlen($pattern) - 1);
$is_similar = true;
}
else
$func = $args[1];
$is_similar = false;
$hints = _get_hints($pattern);
$task = new TaskmanTask($func, $name, $props);
}
else
throw new Exception("Task '$name' is invalid");
$TASKMAN_TASKS[$name] = $task;
foreach($task->getAliases() as $alias)
{
if(isset($TASKMAN_TASKS[$alias]) || isset($TASKMAN_TASK_ALIASES[$alias]))
throw new TaskmanException("Alias '$alias' is already defined for task '$name'");
$TASKMAN_TASK_ALIASES[$alias] = $task;
}
}
foreach($TASKMAN_TASKS as $task)
$task->validate();
}
function _taskman_get_task_candidates()
{
global $TASKMAN_CLOSURES;
$cands = array();
//1. get tasks defined as regular functions
$funcs = get_defined_functions();
foreach($funcs['user'] as $func)
{
$name = TaskmanTask::extractName($func);
if(!$name)
continue;
$cands[$name] = $func;
}
//2. get tasks defined as closures
foreach($TASKMAN_CLOSURES as $name => $args)
{
if(isset($cands[$name]))
throw new Exception("Task '$name' is already defined");
$cands[$name] = $args;
}
ksort($cands);
return $cands;
}
function taskman_gettasks()
{
global $TASKMAN_TASKS;
return $TASKMAN_TASKS;
}
function taskman_gettask($task)
{
global $TASKMAN_TASKS;
global $TASKMAN_TASK_ALIASES;
if(!is_scalar($task))
throw new TaskmanException("Bad task name");
if(isset($TASKMAN_TASKS[$task]))
return $TASKMAN_TASKS[$task];
if(isset($TASKMAN_TASK_ALIASES[$task]))
return $TASKMAN_TASK_ALIASES[$task];
throw new TaskmanException("Task with name/alias '{$task}' does not exist");
}
function _taskman_parse_taskstr($str)
{
$task_spec = array();
$items = explode(',', $str);
foreach($items as $item)
{
$args = null;
$task = $item;
if(strpos($item, ' ') !== false)
@list($task, $args) = explode(' ', $item, 2);
if($args)
$task_spec[] = array($task, explode(' ', $args));
else
$task_spec[] = $task;
}
return $task_spec;
}
function taskman_runtask($task, $args = array())
{
if($task instanceof TaskmanTask)
$task_obj = $task;
else
$task_obj = taskman_gettask($task);
$task_obj->run($args);
}
function taskman_runtasks($tasks, $args = array())
{
foreach($tasks as $task_spec)
{
if(is_array($task_spec))
taskman_runtask($task_spec[0], $task_spec[1]);
else
taskman_runtask($task_spec, $args);
}
}
function taskman_current_task()
{
global $TASKMAN_CURRENT_TASK;
return $TASKMAN_CURRENT_TASK;
}
function taskman_shell_get($cmd, $as_string = true)
{
exec($cmd, $out, $code);
if($code !== 0)
throw new Exception("Error($code) executing shell cmd '$cmd'");
return $as_string ? implode("", $out) : $out;
}
function taskman_shell_ensure($cmd, &$out=null)
{
taskman_shell($cmd, $ret, $out);
if($ret != 0)
throw new TaskmanException("Shell execution error(exit code $ret)");
}
function taskman_shell($cmd, &$ret=null, &$out=null)
{
taskman_msg(" shell: $cmd\n");
taskman_msg(" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
if(func_num_args() < 3)
system($cmd, $ret);
else
_taskman_execute_proc_cmd($cmd, $ret, $out);
}
function _taskman_execute_proc_cmd($cmd, &$ret, &$out)
{
//TODO: do we really need to redirect error stream?
$proc = popen("$cmd 2>&1", 'r');
$log = '';
//TODO: how can this be?
if(is_string($proc))
{
$log = $proc;
taskman_log($log, 1);
}
if($is_similar && count($hints) == 1)
$tasks = $hints;
else
{
while($logline = fgets($proc))
printf("ERROR! Task %s not found\n", $tasks[0]);
if($hints)
{
$log .= $logline;
taskman_log($logline, 1);
printf("Similar tasks:\n");
foreach($hints as $hint)
printf(" %s\n", $hint);
}
exit(1);
}
$out = explode("\n", $log);
$ret = pclose($proc);
}
function taskman_dmsg($msg)
{
taskman_log($msg, 2);
run_many($tasks, $argv);
}
else if($default_task)
$default_task->run($argv);
msg_sys("************************ All done (".round(microtime(true)-$GLOBALS['TASKMAN_START_TIME'],2)." sec.)************************\n");
}
function taskman_msg($msg)
function usage($script_name = "<taskman-script>")
{
taskman_log($msg, 1);
\_taskman_default_usage($script_name);
}
function taskman_sysmsg($msg)
{
taskman_log($msg, 0);
}
function taskman_log($msg, $level = 1)
{
global $TASKMAN_LOG_LEVEL;
if($TASKMAN_LOG_LEVEL < $level)
return;
$logger = $GLOBALS['TASKMAN_LOGGER'];
call_user_func_array($logger, array($msg));
}
function _taskman_default_logger($msg)
{
echo $msg;
}
function _taskman_resolve_callable_prop($name)
{
$prop = $GLOBALS['TASKMAN_PROP_' . $name];
if(!($prop instanceof \Closure))
return;
$value = $prop();
$GLOBALS['TASKMAN_PROP_' . $name] = $value;
}
function taskman_prop($name)
{
if(!isset($GLOBALS['TASKMAN_PROP_' . $name]))
throw new TaskmanException("Property '$name' is not set");
_taskman_resolve_callable_prop($name);
return $GLOBALS['TASKMAN_PROP_' . $name];
}
function taskman_propor($name, $def)
{
if(!isset($GLOBALS['TASKMAN_PROP_' . $name]))
return $def;
_taskman_resolve_callable_prop($name);
return $GLOBALS['TASKMAN_PROP_' . $name];
}
function taskman_propset($name, $value)
{
$GLOBALS['TASKMAN_PROP_' . $name] = $value;
}
function taskman_propadd($name, $value)
{
if(!isset($GLOBALS['TASKMAN_PROP_' . $name]))
$GLOBALS['TASKMAN_PROP_' . $name] = '';
_taskman_resolve_callable_prop($name);
$GLOBALS['TASKMAN_PROP_' . $name] .= $value;
}
function taskman_propsetor($name, $value)
{
if(!isset($GLOBALS['TASKMAN_PROP_' . $name]))
$GLOBALS['TASKMAN_PROP_' . $name] = $value;
}
function taskman_propunset($name)
{
unset($GLOBALS['TASKMAN_PROP_' . $name]);
}
function taskman_getprops()
{
$props = array();
foreach($GLOBALS as $key => $value)
{
if(($idx = strpos($key, 'TASKMAN_PROP_')) === 0)
{
$name = substr($key, strlen('TASKMAN_PROP_'));
$props[$name] = taskman_prop($name);
}
}
return $props;
}
function taskman_isprop($name)
{
return isset($GLOBALS['TASKMAN_PROP_' . $name]);
}
function taskman_default_usage($script_name = "<taskman-script>")
{
echo "\nUsage:\n $script_name [OPTIONS] <task-name1>[,<task-name2>,..] [-D PROP1=value [-D PROP2]]\n\n";
echo "Available options:\n";
echo " -c specify PHP script to be included (handy for setting props,config options,etc)\n";
echo " -V be super verbose\n";
echo " -q be quite, only system messages\n";
echo " -b batch mode: be super quite, don't even output any system messages\n";
echo " -- pass all options verbatim after this mark\n";
}
/**
* @desc Shows this help
*/
function task_help($args = array())
task('help', function($args = array())
{
$filter = '';
if(isset($args[0]))
@ -739,7 +659,7 @@ function task_help($args = array())
$maxlen = -1;
$tasks = array();
$all = taskman_gettasks();
$all = get_tasks();
foreach($all as $task)
{
if($filter && (strpos($task->getName(), $filter) === false && strpos($task->getPropOr("alias", ""), $filter) === false))
@ -776,118 +696,15 @@ function task_help($args = array())
echo " " . $task->getName() . $props_string . " ($file@$line)\n";
}
echo "\n";
}
});
/**
* @desc Encodes tasks as json array
*/
function task_json()
task('json', function()
{
$json = array();
foreach(taskman_gettasks() as $task)
{
foreach(get_tasks() as $task)
$json[$task->getName()] = $task->getProps();
}
echo json_encode($json);
}
} //namespace global
namespace taskman {
function get($name)
{
return \taskman_prop($name);
}
function getor($name, $def)
{
return \taskman_propor($name, $def);
}
function set($name, $value)
{
\taskman_propset($name, $value);
}
function setor($name, $value)
{
\taskman_propsetor($name, $value);
}
function add($name, $value)
{
\taskman_propadd($name, $value);
}
function is($name)
{
return \taskman_isprop($name);
}
function del($name)
{
\taskman_propunset($name);
}
function props()
{
return \taskman_getprops();
}
function task($name)
{
global $TASKMAN_CLOSURES;
$args = func_get_args();
$TASKMAN_CLOSURES[$name] = $args;
}
function run($task, array $args = array())
{
\taskman_runtask($task, $args);
}
function msg_dbg($msg)
{
\taskman_dmsg($msg);
}
function msg($msg)
{
\taskman_msg($msg);
}
function msg_sys($msg)
{
\taskman_sysmsg($msg);
}
function shell($cmd, &$out=null)
{
\taskman_shell_ensure($cmd, $out);
}
function shell_try($cmd, &$ret=null, &$out=null)
{
\taskman_shell($cmd, $ret, $out);
}
function _($str)
{
return \taskman_str($str);
}
function main($argv = array(), $help_func = null, $proc_argv = true)
{
\taskman_run($argv, $help_func, $proc_argv);
}
function usage($script_name = "<taskman-script>")
{
\taskman_default_usage($script_name);
}
});
} //namespace taskman
//}}}