Skip to content

Commit

Permalink
Merge pull request #20 from caendesilva/customize-console-describer-s…
Browse files Browse the repository at this point in the history
…ummary

Customize console describer summary class
  • Loading branch information
caendesilva authored Dec 9, 2023
2 parents cb0d508 + cab1827 commit c53d78c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/Commands/Internal/Describer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace App\Commands\Internal;

use NunoMaduro\LaravelConsoleSummary\Describer as BaseDescriber;

class Describer extends BaseDescriber
{
protected static function sortCommandsInGroup(array &$commands): void
{
usort($commands, function ($a, $b) {
if ($a->getName() === 'new') {
return -1;
}

return strcmp($a->getName(), $b->getName());
});
}
}
5 changes: 5 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use App\Commands\NewProjectCommand;
use App\Commands\ServeCommand;
use App\Commands\Internal\Describer;
use App\Commands\VendorPublishCommand;
use Illuminate\Support\ServiceProvider;
use NunoMaduro\LaravelConsoleSummary\Contracts\DescriberContract;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -32,5 +34,8 @@ public function boot(): void
ServeCommand::class,
VendorPublishCommand::class,
]);

// Register custom Laravel summary command describer implementation.
$this->app->singleton(DescriberContract::class, Describer::class);
}
}

0 comments on commit c53d78c

Please sign in to comment.