34 lines
		
	
	
		
			909 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			909 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use function DI\autowire, DI\create, DI\get;
 | |
| 
 | |
| use Psr\Http\Message\ResponseInterface;
 | |
| 
 | |
| use Mcnd\CLI\CliMiddleware;
 | |
| 
 | |
| use Notes\CLI\CommandFetcher;
 | |
| 
 | |
| use Lean\{ Factory, Lean };
 | |
| 
 | |
| return [
 | |
|     CommandFetcher::class => 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");
 | |
|         };
 | |
|     },
 | |
| ];
 |