-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
build.php
39 lines (34 loc) · 1.26 KB
/
build.php
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
37
38
39
<?php
use Illuminate\Contracts\Console\Kernel;
require __DIR__.'/vendor/autoload.php';
$app = require __DIR__.'/bootstrap/app.php';
$commands = $app->make(Kernel::class)->all();
echo collect($commands)->unique(function ($command) {
return $command->getName();
})->sortBy(function ($command) {
return $command->getName();
})->map(function ($command) {
return [
'name' => $command->getName(),
'description' => $command->getDescription(),
'synopsis' => $command->getSynopsis(),
'definition' => $command->getDefinition(),
'aliases' => $command->getAliases(),
'arguments' => collect($command->getDefinition()->getArguments())->map(function ($argument) {
return [
'name' => $argument->getName(),
'description' => $argument->getDescription(),
'default' => $argument->getDefault(),
'required' => $argument->isRequired(),
];
})->values()->all(),
'options' => collect($command->getDefinition()->getOptions())->map(function ($option) {
return [
'name' => $option->getName(),
'description' => $option->getDescription(),
'value_required' => $option->isValueRequired(),
'value_optional' => $option->isValueOptional(),
];
})->values()->all(),
];
})->values()->toJson();