Getting rid of json task and adding props task

This commit is contained in:
Pavel Shevaev 2022-07-21 23:17:49 +03:00
parent 7806a44238
commit 7d4cc64e24
1 changed files with 18 additions and 5 deletions

View File

@ -699,12 +699,25 @@ task('help', function($args = array())
echo "\n";
});
task('json', function()
task('props', function($args = [])
{
$json = array();
foreach(get_tasks() as $task)
$json[$task->getName()] = $task->getProps();
echo json_encode($json);
$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";
});
} //namespace taskman