Misc fixes and improvements
* Added request logging to com.noccy.apiclient * Added plugin com.noccy.watcher * Added pipe command and filter support * Fixes and stubs
This commit is contained in:
@ -81,3 +81,25 @@ function read_config($file=null) {
|
||||
}
|
||||
return (array)json_decode(file_get_contents($abs), true);
|
||||
}
|
||||
|
||||
|
||||
// ------ Filters ------
|
||||
|
||||
$FILTERS = [];
|
||||
|
||||
function register_filter(string $name, callable $filter) {
|
||||
global $FILTERS;
|
||||
$FILTERS[$name] = $filter;
|
||||
}
|
||||
|
||||
function get_registered_filters(): array
|
||||
{
|
||||
global $FILTERS;
|
||||
return array_keys($FILTERS);
|
||||
}
|
||||
|
||||
function get_filter(string $name): ?callable
|
||||
{
|
||||
global $FILTERS;
|
||||
return $FILTERS[$name]??null;
|
||||
}
|
Reference in New Issue
Block a user