diff --git a/composer.json b/composer.json index 9dc23ff..2a70b74 100644 --- a/composer.json +++ b/composer.json @@ -14,5 +14,14 @@ "psr-4": { "Mcnd\\CLI\\": "src/" } + }, + "extra": { + "lean": { + "autoload": { + "definitions": [ + "meta/definitions.php" + ] + } + } } -} +} \ No newline at end of file diff --git a/meta/definitions.php b/meta/definitions.php new file mode 100644 index 0000000..903aedf --- /dev/null +++ b/meta/definitions.php @@ -0,0 +1,33 @@ + function($c) { + $fetcher = new CommandFetcher(null, null, $c->get('cli.caching')); + + $fetcher->setFolderList(array_map(function($item) { + return $item; + }, $c->get(Lean::class)->getCli())); + + return $fetcher; + }, + + CliMiddleware::class => function($c) { + return new CliMiddleware($c, $c->get('cli.response:default'), $c->get(CommandFetcher::class)); + }, + + 'cli.response:default' => function($c) { + return function() { + return Factory\HttpFactory::createTextResponse("This is the default response from CLI middleware which indicates that no command were registered for this application.\n"); + }; + }, +];