getName(), $filter) === false && strpos($task->getPropOr("alias", ""), $filter) === false)) continue; if(strlen($task->getName()) > $maxlen) $maxlen = strlen($task->getName()); $tasks[] = $task; } if(!$args) { $help_func = $GLOBALS['TASKMAN_HELP_FUNC']; $help_func(); echo "\n"; } echo "Available tasks:\n"; foreach($tasks as $task) { $props_string = ''; $pad = $maxlen - strlen($task->getName()); foreach($task->getProps() as $name => $value) { $props_string .= str_repeat(" ", $pad) .' @' . $name . ' ' . (is_string($value) ? $value : json_encode($value)) . "\n"; $pad = $maxlen + 1; } $props_string = rtrim($props_string); echo "---------------------------------\n"; $file = $task->getFile(); $line = $task->getLine(); echo " " . $task->getName() . $props_string . " ($file@$line)\n"; } echo "\n"; }); task('props', function($args = []) { $filter = ''; if(isset($args[0])) $filter = $args[0]; $props = props(); echo "\n"; echo "Available props:\n"; foreach($props as $k => $v) { if($filter && stripos($k, $filter) === false) continue; echo "---------------------------------\n"; echo "$k : " . var_export($v, true) . "\n"; } echo "\n"; });