-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathDusterServiceProvider.php
More file actions
36 lines (30 loc) · 1.13 KB
/
DusterServiceProvider.php
File metadata and controls
36 lines (30 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace App\Providers;
use App\Project;
use App\Support\DusterConfig;
use Illuminate\Support\ServiceProvider;
use Symfony\Component\Console\Input\InputInterface;
class DusterServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton(DusterConfig::class, function () {
$input = $this->app->get(InputInterface::class);
$mode = match ($input->getArgument('command')) {
'lint' => 'lint',
'fix' => 'fix',
default => 'other',
};
$dusterConfig = DusterConfig::loadLocal();
$excludeFromCli = array_filter(explode(',', (string) $input->getOption('exclude')));
return new DusterConfig([
'paths' => Project::paths($input),
'using' => $input->getOption('using'),
'mode' => $mode,
'include' => $dusterConfig['include'] ?? [],
'exclude' => array_merge($dusterConfig['exclude'] ?? [], $excludeFromCli),
'scripts' => $dusterConfig['scripts'] ?? [],
]);
});
}
}