Skip to content

Commit

Permalink
Merge pull request #302 from Cryborg/add_sort_groupby_to_command
Browse files Browse the repository at this point in the history
Add sort & groupby to export command
  • Loading branch information
kevincobain2000 authored Oct 30, 2023
2 parents 3307679 + e051236 commit a31cfb7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Commands/ExportRequestDocsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ public function __construct(LaravelRequestDocs $laravelRequestDoc, LaravelReques
*/
protected $signature = 'laravel-request-docs:export
{path? : Export file location}
{--sort=default : Sort the data by route names}
{--groupby=default : Group the data by API URI}
{--force : Whether to overwrite existing file}';


/**
* The console command description.
*
Expand Down Expand Up @@ -75,8 +78,8 @@ public function handle()

// Loop and split Doc by the `methods` property.
$docs = $this->laravelRequestDocs->splitByMethods($docs);
$docs = $this->laravelRequestDocs->sortDocs($docs, 'default');
$docs = $this->laravelRequestDocs->groupDocs($docs, 'default');
$docs = $this->laravelRequestDocs->sortDocs($docs, $this->option('sort'));
$docs = $this->laravelRequestDocs->groupDocs($docs, $this->option('groupby'));

if (!$this->writeApiDocsToFile($docs)) {
throw new ErrorException("Failed to write on [{$this->exportFilePath}] file.");
Expand Down

0 comments on commit a31cfb7

Please sign in to comment.