File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ class GenerateSwaggerDoc extends Command
13
13
*/
14
14
protected $ signature = 'laravel-swagger:generate
15
15
{--format=json : The format of the output, current options are json and yaml}
16
- {--filter= : Filter to a specific route prefix, such as /api or /v2/api} ' ;
16
+ {--f|filter= : Filter to a specific route prefix, such as /api or /v2/api}
17
+ {--o|output= : Output file to write the contents to, defaults to stdout} ' ;
17
18
18
19
/**
19
20
* The console command description.
@@ -30,13 +31,19 @@ class GenerateSwaggerDoc extends Command
30
31
public function handle ()
31
32
{
32
33
$ config = config ('laravel-swagger ' );
34
+ $ filter = $ this ->option ('filter ' ) ?: null ;
35
+ $ file = $ this ->option ('output ' ) ?: null ;
33
36
34
- $ docs = (new Generator ($ config , $ this -> option ( ' filter ' ) ?: null ))->generate ();
37
+ $ docs = (new Generator ($ config , $ filter ))->generate ();
35
38
36
39
$ formattedDocs = (new FormatterManager ($ docs ))
37
40
->setFormat ($ this ->option ('format ' ))
38
41
->format ();
39
42
40
- $ this ->line ($ formattedDocs );
43
+ if ($ file ) {
44
+ file_put_contents ($ file , $ formattedDocs );
45
+ } else {
46
+ $ this ->line ($ formattedDocs );
47
+ }
41
48
}
42
- }
49
+ }
You can’t perform that action at this time.
0 commit comments