From 7d4cc64e24b3bca06720ae7d4636b50ddc2891e8 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 21 Jul 2022 23:17:49 +0300 Subject: [PATCH] Getting rid of json task and adding props task --- taskman.inc.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/taskman.inc.php b/taskman.inc.php index ae3118a..4ee6da2 100644 --- a/taskman.inc.php +++ b/taskman.inc.php @@ -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