From e051236c41d462b912750a1a24de8678970dd4ca Mon Sep 17 00:00:00 2001 From: Franck Date: Fri, 27 Oct 2023 16:24:24 +0200 Subject: [PATCH] Add sort & groupby to export command --- src/Commands/ExportRequestDocsCommand.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Commands/ExportRequestDocsCommand.php b/src/Commands/ExportRequestDocsCommand.php index c7913ce..a939af1 100644 --- a/src/Commands/ExportRequestDocsCommand.php +++ b/src/Commands/ExportRequestDocsCommand.php @@ -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. * @@ -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.");